diff options
| author | David Wood <david@davidtw.co> | 2019-01-29 13:34:40 +0100 |
|---|---|---|
| committer | David Wood <david@davidtw.co> | 2019-01-31 12:01:28 +0100 |
| commit | 1595163356546e8a4db55784bcc591e2c5cea26c (patch) | |
| tree | 29590b60d7f33441479541a23f1fc04fa7a56b20 /src/libsyntax | |
| parent | a21bd756889942cfed06dfd4ccd08838fc27ffdf (diff) | |
| download | rust-1595163356546e8a4db55784bcc591e2c5cea26c.tar.gz rust-1595163356546e8a4db55784bcc591e2c5cea26c.zip | |
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.
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 |
