Skip to content

Commit 2f5a648

Browse files
committed
Fixed logic error
1 parent 6cfbff1 commit 2f5a648

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

cortex-m-rt/macros/src/lib.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,14 @@ fn extract_cfgs(attrs: Vec<Attribute>) -> (Vec<Attribute>, Vec<Attribute>) {
832832

833833
fn check_for_blacklisted_attrs(attrs: &[Attribute]) -> Option<TokenStream> {
834834
if let Some(val) = containts_blacklist_attrs(attrs) {
835-
return Some(parse::Error::new(val.span(), "this attribute is not allowed on a function controlled by cortex-m-rt")
835+
return Some(
836+
parse::Error::new(
837+
val.span(),
838+
"this attribute is not allowed on a function controlled by cortex-m-rt",
839+
)
836840
.to_compile_error()
837-
.into());
841+
.into(),
842+
);
838843
}
839844

840845
None
@@ -843,12 +848,14 @@ fn check_for_blacklisted_attrs(attrs: &[Attribute]) -> Option<TokenStream> {
843848
fn containts_blacklist_attrs(attrs: &[Attribute]) -> Option<Attribute> {
844849
let whitelist = &["doc", "link_section"];
845850

846-
for attr in attrs {
851+
'o: for attr in attrs {
847852
for val in whitelist {
848-
if !eq(&attr, &val) {
849-
return Some(attr.clone());
853+
if eq(&attr, &val) {
854+
continue 'o;
850855
}
851856
}
857+
858+
return Some(attr.clone());
852859
}
853860

854861
None

0 commit comments

Comments
 (0)