Skip to content

Commit 88d64a0

Browse files
committed
Simplify span usage and avoid .eat()
1 parent 3c91bdc commit 88d64a0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc_parse/parser/path.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ impl<'a> Parser<'a> {
7171
debug!("parse_qpath: (decrement) count={:?}", self.unmatched_angle_bracket_count);
7272
}
7373

74-
let lo_colon = self.token.span;
75-
if self.eat(&token::Colon) {
74+
if self.token.kind == token::Colon {
7675
// <Bar as Baz<T>>:Qux
7776
// ^
78-
let span = lo_colon.to(self.prev_span);
77+
self.bump();
78+
7979
self.diagnostic()
80-
.struct_span_err(span, "found single colon where type path was expected")
80+
.struct_span_err(self.prev_span, "found single colon where type path was expected")
8181
.span_suggestion(
82-
span,
82+
self.prev_span,
8383
"use double colon",
8484
"::".to_string(),
8585
Applicability::MachineApplicable,

0 commit comments

Comments
 (0)