diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-11-15 14:01:53 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-11-25 16:10:55 +1100 |
| commit | 4cd2840f003a1aa29da7e688043b954b4659b2ca (patch) | |
| tree | d4083c6059174af3478a4eb468512ad0eee18343 /compiler/rustc_lexer/src | |
| parent | 11c96cfd94a9b24a11d20c94686929126991f8d9 (diff) | |
| download | rust-4cd2840f003a1aa29da7e688043b954b4659b2ca.tar.gz rust-4cd2840f003a1aa29da7e688043b954b4659b2ca.zip | |
Clean up `c_or_byte_string`.
- Rename a misleading local `mk_kind` as `single_quoted`. - Use `fn` for all three arguments, for consistency.
Diffstat (limited to 'compiler/rustc_lexer/src')
| -rw-r--r-- | compiler/rustc_lexer/src/lib.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_lexer/src/lib.rs b/compiler/rustc_lexer/src/lib.rs index bcb103957ba..b584e7afd98 100644 --- a/compiler/rustc_lexer/src/lib.rs +++ b/compiler/rustc_lexer/src/lib.rs @@ -566,19 +566,19 @@ impl Cursor<'_> { fn c_or_byte_string( &mut self, - mk_kind: impl FnOnce(bool) -> LiteralKind, - mk_kind_raw: impl FnOnce(Option<u8>) -> LiteralKind, + mk_kind: fn(bool) -> LiteralKind, + mk_kind_raw: fn(Option<u8>) -> LiteralKind, single_quoted: Option<fn(bool) -> LiteralKind>, ) -> TokenKind { match (self.first(), self.second(), single_quoted) { - ('\'', _, Some(mk_kind)) => { + ('\'', _, Some(single_quoted)) => { self.bump(); let terminated = self.single_quoted_string(); let suffix_start = self.pos_within_token(); if terminated { self.eat_literal_suffix(); } - let kind = mk_kind(terminated); + let kind = single_quoted(terminated); Literal { kind, suffix_start } } ('"', _, _) => { |
