diff options
| author | bors <bors@rust-lang.org> | 2019-02-05 05:14:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-02-05 05:14:15 +0000 |
| commit | b2c6b8c29f13f8d1f242da89e587960b95337819 (patch) | |
| tree | 92927fb4e6748fe396cd9eae073dd4d151f2830d /src/libsyntax | |
| parent | 710ddc151baf9750e074229b8bdc794d63246eb8 (diff) | |
| parent | 1595163356546e8a4db55784bcc591e2c5cea26c (diff) | |
| download | rust-b2c6b8c29f13f8d1f242da89e587960b95337819.tar.gz rust-b2c6b8c29f13f8d1f242da89e587960b95337819.zip | |
Auto merge of #57973 - davidtwco:issue-52891, r=estebank
Add suggestion for duplicated import. Fixes #52891. This PR 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.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 7 |
1 files changed, 7 insertions, 0 deletions
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<TokenStream>, } +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 |
