From 2f5a6487cfd94d6ccde3128c82fa43bddd2d228f Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Sun, 29 Dec 2019 20:16:18 +0100 Subject: Fixed logic error --- cortex-m-rt/macros/src/lib.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'cortex-m-rt/macros/src/lib.rs') 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) -> (Vec, Vec) { fn check_for_blacklisted_attrs(attrs: &[Attribute]) -> Option { 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 { fn containts_blacklist_attrs(attrs: &[Attribute]) -> Option { 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 -- cgit v1.2.3