Skip to content

Commit 7149a21

Browse files
author
Julian Wollersberger
committed
Address the "Hidden lifetime in path" warning.
This one wasn't shown with `cargo check`.
1 parent d4336a5 commit 7149a21

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

compiler/rustc_lexer/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ pub fn first_token(input: &str) -> Token {
381381
Token::new(token_kind, cursor.len_consumed())
382382
}
383383

384-
fn line_comment(cursor: &mut Cursor) -> TokenKind {
384+
fn line_comment(cursor: &mut Cursor<'_>) -> TokenKind {
385385
debug_assert!(cursor.prev() == '/' && cursor.peek() == '/');
386386
cursor.bump();
387387

@@ -397,7 +397,7 @@ fn line_comment(cursor: &mut Cursor) -> TokenKind {
397397
LineComment { doc_style }
398398
}
399399

400-
fn block_comment(cursor: &mut Cursor) -> TokenKind {
400+
fn block_comment(cursor: &mut Cursor<'_>) -> TokenKind {
401401
debug_assert!(cursor.prev() == '/' && cursor.peek() == '*');
402402
cursor.bump();
403403

@@ -435,7 +435,7 @@ fn block_comment(cursor: &mut Cursor) -> TokenKind {
435435
}
436436

437437
/// Start is already eaten, eat the rest of identifier.
438-
pub(crate) fn ident(cursor: &mut Cursor) -> TokenKind {
438+
pub(crate) fn ident(cursor: &mut Cursor<'_>) -> TokenKind {
439439
debug_assert!(is_id_start(cursor.prev()));
440440
cursor.bump_while(is_id_continue);
441441
Ident

compiler/rustc_lexer/src/literals.rs

+13-10
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub enum RawStrError {
5151
TooManyDelimiters { found: usize },
5252
}
5353

54-
pub(crate) fn number(cursor: &mut Cursor, first_digit: char) -> LiteralKind {
54+
pub(crate) fn number(cursor: &mut Cursor<'_>, first_digit: char) -> LiteralKind {
5555
debug_assert!('0' <= cursor.prev() && cursor.prev() <= '9');
5656
let mut base = Base::Decimal;
5757
if first_digit == '0' {
@@ -120,7 +120,7 @@ pub(crate) fn number(cursor: &mut Cursor, first_digit: char) -> LiteralKind {
120120
}
121121
}
122122

123-
pub(crate) fn eat_decimal_digits(cursor: &mut Cursor) -> bool {
123+
pub(crate) fn eat_decimal_digits(cursor: &mut Cursor<'_>) -> bool {
124124
let mut has_digits = false;
125125
loop {
126126
match cursor.peek() {
@@ -137,7 +137,7 @@ pub(crate) fn eat_decimal_digits(cursor: &mut Cursor) -> bool {
137137
has_digits
138138
}
139139

140-
pub(crate) fn eat_hexadecimal_digits(cursor: &mut Cursor) -> bool {
140+
pub(crate) fn eat_hexadecimal_digits(cursor: &mut Cursor<'_>) -> bool {
141141
let mut has_digits = false;
142142
loop {
143143
match cursor.peek() {
@@ -156,15 +156,15 @@ pub(crate) fn eat_hexadecimal_digits(cursor: &mut Cursor) -> bool {
156156

157157
/// Eats the float exponent. Returns true if at least one digit was met,
158158
/// and returns false otherwise.
159-
fn eat_float_exponent(cursor: &mut Cursor) -> bool {
159+
fn eat_float_exponent(cursor: &mut Cursor<'_>) -> bool {
160160
debug_assert!(cursor.prev() == 'e' || cursor.prev() == 'E');
161161
if cursor.peek() == '-' || cursor.peek() == '+' {
162162
cursor.bump();
163163
}
164164
eat_decimal_digits(cursor)
165165
}
166166

167-
pub(crate) fn lifetime_or_char(cursor: &mut Cursor) -> TokenKind {
167+
pub(crate) fn lifetime_or_char(cursor: &mut Cursor<'_>) -> TokenKind {
168168
debug_assert!(cursor.prev() == '\'');
169169

170170
let can_be_a_lifetime = if cursor.peek_second() == '\'' {
@@ -210,7 +210,7 @@ pub(crate) fn lifetime_or_char(cursor: &mut Cursor) -> TokenKind {
210210
}
211211
}
212212

213-
pub(crate) fn single_quoted_string(cursor: &mut Cursor) -> bool {
213+
pub(crate) fn single_quoted_string(cursor: &mut Cursor<'_>) -> bool {
214214
debug_assert!(cursor.prev() == '\'');
215215
// Check if it's a one-symbol literal.
216216
if cursor.peek_second() == '\'' && cursor.peek() != '\\' {
@@ -253,7 +253,7 @@ pub(crate) fn single_quoted_string(cursor: &mut Cursor) -> bool {
253253

254254
/// Eats double-quoted string and returns true
255255
/// if string is terminated.
256-
pub(crate) fn double_quoted_string(cursor: &mut Cursor) -> bool {
256+
pub(crate) fn double_quoted_string(cursor: &mut Cursor<'_>) -> bool {
257257
debug_assert!(cursor.prev() == '"');
258258
while let Some(c) = cursor.bump() {
259259
match c {
@@ -273,7 +273,7 @@ pub(crate) fn double_quoted_string(cursor: &mut Cursor) -> bool {
273273

274274
/// Eats the double-quoted string and returns `n_hashes` and an error if encountered.
275275
pub(crate) fn raw_double_quoted_string(
276-
cursor: &mut Cursor,
276+
cursor: &mut Cursor<'_>,
277277
prefix_len: usize,
278278
) -> (u16, Option<RawStrError>) {
279279
// Wrap the actual function to handle the error with too many hashes.
@@ -288,7 +288,10 @@ pub(crate) fn raw_double_quoted_string(
288288
}
289289
}
290290

291-
fn raw_string_unvalidated(cursor: &mut Cursor, prefix_len: usize) -> (usize, Option<RawStrError>) {
291+
fn raw_string_unvalidated(
292+
cursor: &mut Cursor<'_>,
293+
prefix_len: usize,
294+
) -> (usize, Option<RawStrError>) {
292295
debug_assert!(cursor.prev() == 'r');
293296
let start_pos = cursor.len_consumed();
294297
let mut possible_terminator_offset = None;
@@ -354,7 +357,7 @@ fn raw_string_unvalidated(cursor: &mut Cursor, prefix_len: usize) -> (usize, Opt
354357
}
355358

356359
/// Eats the suffix of a literal, e.g. "_u8".
357-
pub(crate) fn eat_literal_suffix(cursor: &mut Cursor) {
360+
pub(crate) fn eat_literal_suffix(cursor: &mut Cursor<'_>) {
358361
// Eats one identifier.
359362
if is_id_start(cursor.peek()) {
360363
cursor.bump();

0 commit comments

Comments
 (0)