This is a follow on for #69 to cover the one TODO that was not cleaned up by #72.
The TODO can be found here:
|
impl Parse for FunctionMacroArgs { |
|
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> { |
|
let mut args = Self::default(); |
|
while !input.is_empty() { |
|
let lookahead = input.lookahead1(); |
|
if lookahead.peek(kw::name) { |
|
if args.name.is_some() { |
|
return Err(input.error("expected only a single `name` argument")); |
|
} |
|
let name = input.parse::<StrArg<kw::name>>()?.value; |
|
args.name = Some(name); |
|
} else { |
|
// TODO - may want to warn here when found a invalid arg - see how |
|
// tracing::instrument stores warnings and emits them later when generating the |
|
// expanded token stream. |
|
let _ = input.parse::<proc_macro2::TokenTree>(); |
|
} |
|
} |
|
Ok(args) |
|
} |
|
} |
I believe that if unsupported arguments are passed to the #[function] macro, it will just ignore them, but should instead emit compiler warnings.
This is a follow on for #69 to cover the one
TODOthat was not cleaned up by #72.The
TODOcan be found here:serde_json_path/serde_json_path_macros/src/internal/func/args.rs
Lines 10 to 30 in 5dd145d
I believe that if unsupported arguments are passed to the
#[function]macro, it will just ignore them, but should instead emit compiler warnings.