From f1860d190131c643c3f5db97fdbcb69adc57a789 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 12 Aug 2021 17:35:37 +0200 Subject: Include attributes in removal span for unused imports. --- compiler/rustc_resolve/src/check_unused.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/rustc_resolve/src') diff --git a/compiler/rustc_resolve/src/check_unused.rs b/compiler/rustc_resolve/src/check_unused.rs index 89ce89b2e9a..9f4f2b82f60 100644 --- a/compiler/rustc_resolve/src/check_unused.rs +++ b/compiler/rustc_resolve/src/check_unused.rs @@ -98,7 +98,7 @@ impl<'a, 'b> UnusedImportCheckVisitor<'a, 'b> { impl<'a, 'b> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b> { fn visit_item(&mut self, item: &'a ast::Item) { - self.item_span = item.span; + self.item_span = item.span_with_attributes(); // Ignore is_public import statements because there's no way to be sure // whether they're used or not. Also ignore imports with a dummy span -- cgit 1.4.1-3-g733a5