Skip to content

Commit

Permalink
Simplify span usage and avoid .eat()
Browse files Browse the repository at this point in the history
  • Loading branch information
bobrippling committed Feb 1, 2020
1 parent 3c91bdc commit 88d64a0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/librustc_parse/parser/path.rs
Expand Up @@ -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,
Expand Down

0 comments on commit 88d64a0

Please sign in to comment.