diff options
author | 2019-12-29 20:16:18 +0100 | |
---|---|---|
committer | 2019-12-29 20:16:18 +0100 | |
commit | 2f5a6487cfd94d6ccde3128c82fa43bddd2d228f (patch) | |
tree | a38717618141960008737a1ad3c00d9b7401ea71 /cortex-m-rt/macros/src/lib.rs | |
parent | 6cfbff156b9475da4a2fd3bdaed12244a79085bd (diff) | |
download | cortex-m-2f5a6487cfd94d6ccde3128c82fa43bddd2d228f.tar.gz cortex-m-2f5a6487cfd94d6ccde3128c82fa43bddd2d228f.tar.zst cortex-m-2f5a6487cfd94d6ccde3128c82fa43bddd2d228f.zip |
Fixed logic error
Diffstat (limited to 'cortex-m-rt/macros/src/lib.rs')
-rw-r--r-- | cortex-m-rt/macros/src/lib.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/cortex-m-rt/macros/src/lib.rs b/cortex-m-rt/macros/src/lib.rs index 803915c..be27165 100644 --- a/cortex-m-rt/macros/src/lib.rs +++ b/cortex-m-rt/macros/src/lib.rs @@ -832,9 +832,14 @@ fn extract_cfgs(attrs: Vec<Attribute>) -> (Vec<Attribute>, Vec<Attribute>) { fn check_for_blacklisted_attrs(attrs: &[Attribute]) -> Option<TokenStream> { if let Some(val) = containts_blacklist_attrs(attrs) { - return Some(parse::Error::new(val.span(), "this attribute is not allowed on a function controlled by cortex-m-rt") + return Some( + parse::Error::new( + val.span(), + "this attribute is not allowed on a function controlled by cortex-m-rt", + ) .to_compile_error() - .into()); + .into(), + ); } None @@ -843,12 +848,14 @@ fn check_for_blacklisted_attrs(attrs: &[Attribute]) -> Option<TokenStream> { fn containts_blacklist_attrs(attrs: &[Attribute]) -> Option<Attribute> { let whitelist = &["doc", "link_section"]; - for attr in attrs { + 'o: for attr in attrs { for val in whitelist { - if !eq(&attr, &val) { - return Some(attr.clone()); + if eq(&attr, &val) { + continue 'o; } } + + return Some(attr.clone()); } None |