From b676e99b605274c48bea04d344ff18c546041a8f Mon Sep 17 00:00:00 2001 From: Lee Jeffery Date: Mon, 29 Jun 2015 20:40:18 +0100 Subject: [PATCH] Fix incorrect warning about unused repr attributes. --- src/librustc_lint/builtin.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index db48608823d2..16db45c909d8 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -821,10 +821,12 @@ fn get_lints(&self) -> LintArray { } fn check_item(&mut self, cx: &Context, it: &ast::Item) { - let has_extern_repr = it.attrs.iter().any(|attr| { + let extern_repr_count = it.attrs.iter().filter(|attr| { attr::find_repr_attrs(cx.tcx.sess.diagnostic(), attr).iter() .any(|r| r == &attr::ReprExtern) - }); + }).count(); + let has_extern_repr = extern_repr_count > 0; + if has_extern_repr { return; }