diff options
author | Akshay <[email protected]> | 2021-10-31 16:01:04 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2021-10-31 16:01:04 +0000 |
commit | 15ccd864c8869f87a564e5ab7e923dcc2bb54340 (patch) | |
tree | 9d47b230d5d4ad1b0f40ba88f097418b981805a4 /macros/src | |
parent | 4567a246a0b63418f17ead4adc81f5ebab8bdd81 (diff) |
add explainations to each lint
Diffstat (limited to 'macros/src')
-rw-r--r-- | macros/src/explain.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/macros/src/explain.rs b/macros/src/explain.rs index 8b00740..9bc3c29 100644 --- a/macros/src/explain.rs +++ b/macros/src/explain.rs | |||
@@ -7,15 +7,15 @@ pub fn generate_explain_impl(struct_item: &ItemStruct) -> TokenStream2 { | |||
7 | let explain = struct_item | 7 | let explain = struct_item |
8 | .attrs | 8 | .attrs |
9 | .iter() | 9 | .iter() |
10 | .filter_map(|a| a.parse_meta().ok()) | 10 | .filter_map(|attr| match attr.parse_meta().ok() { |
11 | .filter_map(|meta| match meta { | 11 | Some(Meta::NameValue(MetaNameValue { |
12 | Meta::NameValue(MetaNameValue { path, lit, .. }) if path.is_ident("doc") => Some(lit), | 12 | path, |
13 | _ => None, | 13 | lit: Lit::Str(str_lit), |
14 | }) | 14 | .. |
15 | .filter_map(|lit| match lit { | 15 | })) if path.is_ident("doc") => Some(str_lit.value()), |
16 | Lit::Str(str_lit) => Some(str_lit.value()), | ||
17 | _ => None, | 16 | _ => None, |
18 | }) | 17 | }) |
18 | .map(|s| s.strip_prefix(' ').unwrap_or(&s).to_owned()) | ||
19 | .collect::<Vec<_>>() | 19 | .collect::<Vec<_>>() |
20 | .join("\n"); | 20 | .join("\n"); |
21 | quote! { | 21 | quote! { |