From 1595163356546e8a4db55784bcc591e2c5cea26c Mon Sep 17 00:00:00 2001 From: David Wood Date: Tue, 29 Jan 2019 13:34:40 +0100 Subject: Add suggestion for duplicated import. This commit adds a suggestion when a import is duplicated (ie. the same name is used twice trying to import the same thing) to remove the second import. --- src/libsyntax/ast.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index af521848e90..4f3f5631cc3 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -2164,6 +2164,13 @@ pub struct Item { pub tokens: Option, } +impl Item { + /// Return the span that encompasses the attributes. + pub fn span_with_attributes(&self) -> Span { + self.attrs.iter().fold(self.span, |acc, attr| acc.to(attr.span())) + } +} + /// A function header. /// /// All the information between the visibility and the name of the function is -- cgit 1.4.1-3-g733a5