]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_parse/src/parser/stmt.rs
Use `token::Lit` in `ast::ExprKind::Lit`.
[rust.git] / compiler / rustc_parse / src / parser / stmt.rs
index 18b661034e070915d4b0893054e088a0dab4ba6e..7820bbc178948c4f986f31055927e19f33112370 100644 (file)
@@ -359,7 +359,7 @@ fn parse_local(&mut self, attrs: AttrVec) -> PResult<'a, P<Local>> {
     /// report error for `let 1x = 123`
     pub fn report_invalid_identifier_error(&mut self) -> PResult<'a, ()> {
         if let token::Literal(lit) = self.token.uninterpolate().kind &&
-            let Err(_) = rustc_ast::Lit::from_token(&self.token) &&
+            rustc_ast::Lit::from_token(&self.token).is_none() &&
             (lit.kind == token::LitKind::Integer || lit.kind == token::LitKind::Float) &&
             self.look_ahead(1, |t| matches!(t.kind, token::Eq) || matches!(t.kind, token::Colon ) ) {
                 return Err(self.sess.create_err(InvalidIdentiferStartsWithNumber { span: self.token.span }));