diff options
| author | Rob Pilling <robpilling@gmail.com> | 2020-02-01 19:06:15 +0000 |
|---|---|---|
| committer | Rob Pilling <robpilling@gmail.com> | 2020-02-01 19:07:58 +0000 |
| commit | 88d64a09314d7f19201eebc1b92377afed31b5c2 (patch) | |
| tree | 0d34c3c17c6d63cab6e93ea307db93975c00b75a /src/librustc_parse/parser | |
| parent | 3c91bdca1d552055e2b92ecac5275c1ebe9a4ee8 (diff) | |
| download | rust-88d64a09314d7f19201eebc1b92377afed31b5c2.tar.gz rust-88d64a09314d7f19201eebc1b92377afed31b5c2.zip | |
Simplify span usage and avoid .eat()
Diffstat (limited to 'src/librustc_parse/parser')
| -rw-r--r-- | src/librustc_parse/parser/path.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc_parse/parser/path.rs b/src/librustc_parse/parser/path.rs index 25ba571a6a4..a4541046c6c 100644 --- a/src/librustc_parse/parser/path.rs +++ b/src/librustc_parse/parser/path.rs @@ -71,15 +71,15 @@ impl<'a> Parser<'a> { debug!("parse_qpath: (decrement) count={:?}", self.unmatched_angle_bracket_count); } - let lo_colon = self.token.span; - if self.eat(&token::Colon) { + if self.token.kind == token::Colon { // <Bar as Baz<T>>:Qux // ^ - let span = lo_colon.to(self.prev_span); + self.bump(); + self.diagnostic() - .struct_span_err(span, "found single colon where type path was expected") + .struct_span_err(self.prev_span, "found single colon where type path was expected") .span_suggestion( - span, + self.prev_span, "use double colon", "::".to_string(), Applicability::MachineApplicable, |
