-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
67e3521
commit 62cc083
Showing
3 changed files
with
64 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
use syn::{Meta, Token}; | ||
use syn::parse::{Parse, ParseStream}; | ||
use syn::punctuated::Punctuated; | ||
use syn::token::Comma; | ||
use syn::{Meta, Token}; | ||
|
||
/// When doing static analysis, `structmeta` and `darling` do not parse attributes | ||
/// in a cfg_attr, so we have this struct to enable that | ||
pub struct CfgAttr { | ||
pub condition: Meta, | ||
// pub _condition: Meta, | ||
pub attrs: Punctuated<Meta, Token![,]>, | ||
} | ||
|
||
impl Parse for CfgAttr { | ||
fn parse(input: ParseStream) -> syn::Result<Self> { | ||
let condition = input.parse()?; | ||
let _condition: Meta = input.parse()?; | ||
let _: Comma = input.parse()?; | ||
let attrs = input.parse_terminated(Meta::parse, Token![,])?; | ||
Ok(CfgAttr { | ||
condition, | ||
attrs, | ||
}) | ||
Ok(CfgAttr { attrs }) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters