salsa/components/salsa-macros/src/tracked.rs
Lukas Wirth a89e3d2357
chore: Normalize imports style (#779)
* Default impl some ingredient functions

* chore: Normalize imports style

Effectively reformatted everything with
```toml
imports_granularity = "Module"
group_imports = "StdExternalCrate"
reorder_imports = true
```
2025-03-28 05:11:40 +00:00

24 lines
784 B
Rust

use syn::spanned::Spanned;
use syn::Item;
use crate::token_stream_with_error;
pub(crate) fn tracked(
args: proc_macro::TokenStream,
input: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
let item = parse_macro_input!(input as Item);
let res = match item {
syn::Item::Struct(item) => crate::tracked_struct::tracked_struct(args, item),
syn::Item::Fn(item) => crate::tracked_fn::tracked_fn(args, item),
syn::Item::Impl(item) => crate::tracked_impl::tracked_impl(args, item),
_ => Err(syn::Error::new(
item.span(),
"tracked can only be applied to structs, functions, and impls",
)),
};
match res {
Ok(s) => s.into(),
Err(err) => token_stream_with_error(input, err),
}
}