diff options
Diffstat (limited to 'macros')
-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! { |