chiark / gitweb /
config macros: Promote atspan variable
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Aug 2021 17:43:29 +0000 (18:43 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Aug 2021 18:43:38 +0000 (19:43 +0100)
We're going to want to use this in the other branches.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
macros/macros.rs

index 88828ae82a0f4a2b01f3f2aad8c0667a1dcfce69..f190bdb3a431d95c58e05e4d9d524b2868447753 100644 (file)
@@ -56,8 +56,8 @@ pub fn resolve(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
     let mut skl = quote_spanned!{fname_span=> SectionKindList::Ordinary };
     let mut method = quote_spanned!{fname_span=> ordinary };
     for attr in &field.attrs {
+      let atspan = attr.path.segments.last().unwrap().ident.span();
       if attr.tokens.is_empty() {
-        let atspan = attr.path.segments.last().unwrap().ident.span();
         method = attr.path.to_token_stream();
         if &attr.path == &parse_quote!{ limited } {
           skl = quote_spanned!{atspan=> SectionKindList::Limited };