]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_ast/src/token.rs
Use verbose suggestions and only match if the + is seen before a numeric literal
[rust.git] / compiler / rustc_ast / src / token.rs
index 710a592e258b43d1ec067d6562e9c705ebee05b8..e467bd963bf3c9304e903b7f5c80d6a44d91e029 100644 (file)
@@ -586,6 +586,10 @@ pub fn is_bool_lit(&self) -> bool {
         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() {