Skip to content

Commit b676e99

Browse files
author
Lee Jeffery
committed
Fix incorrect warning about unused repr attributes.
1 parent 216f664 commit b676e99

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustc_lint/builtin.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,10 +821,12 @@ impl LintPass for NonCamelCaseTypes {
821821
}
822822

823823
fn check_item(&mut self, cx: &Context, it: &ast::Item) {
824-
let has_extern_repr = it.attrs.iter().any(|attr| {
824+
let extern_repr_count = it.attrs.iter().filter(|attr| {
825825
attr::find_repr_attrs(cx.tcx.sess.diagnostic(), attr).iter()
826826
.any(|r| r == &attr::ReprExtern)
827-
});
827+
}).count();
828+
let has_extern_repr = extern_repr_count > 0;
829+
828830
if has_extern_repr {
829831
return;
830832
}

0 commit comments

Comments
 (0)