diff options
| author | Theodore Luo Wang <wangtheo662@gmail.com> | 2021-09-04 22:35:59 -0400 |
|---|---|---|
| committer | Theodore Luo Wang <wangtheo662@gmail.com> | 2021-09-04 22:35:59 -0400 |
| commit | 65eb7e516c798a9447dbfe1d02aeeb314d4fec54 (patch) | |
| tree | 59b304b05a220c76dae75df4119d7809561ae5f5 /compiler/rustc_ast | |
| parent | bc9877c5af5155174f1a517d41d997b446cc074e (diff) | |
| download | rust-65eb7e516c798a9447dbfe1d02aeeb314d4fec54.tar.gz rust-65eb7e516c798a9447dbfe1d02aeeb314d4fec54.zip | |
Use verbose suggestions and only match if the + is seen before a numeric literal
Diffstat (limited to 'compiler/rustc_ast')
| -rw-r--r-- | compiler/rustc_ast/src/token.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs index 710a592e258..e467bd963bf 100644 --- a/compiler/rustc_ast/src/token.rs +++ b/compiler/rustc_ast/src/token.rs @@ -586,6 +586,10 @@ impl Token { self.is_non_raw_ident_where(|id| id.name.is_bool_lit()) } + pub fn is_numeric_lit(&self) -> bool { + matches!(self.kind, Literal(Lit { kind: LitKind::Integer, ..}) | Literal(Lit { kind: LitKind::Float, ..})) + } + /// Returns `true` if the token is a non-raw identifier for which `pred` holds. pub fn is_non_raw_ident_where(&self, pred: impl FnOnce(Ident) -> bool) -> bool { match self.ident() { |
