]> git.lizzy.rs Git - rust.git/blobdiff - crates/hir_def/src/body/lower.rs
Merge #9269
[rust.git] / crates / hir_def / src / body / lower.rs
index da1fdac33aec5371dfb1d336cdb23278143fad7c..f6e6cdbe2e3d2ff31ab7d301dd67644c12302ef2 100644 (file)
@@ -690,9 +690,7 @@ fn collect_stmt(&mut self, s: ast::Stmt) {
                 }
             }
             ast::Stmt::Item(item) => {
-                if self.check_cfg(&item).is_none() {
-                    return;
-                }
+                self.check_cfg(&item);
             }
         }
     }
@@ -717,7 +715,8 @@ fn collect_block(&mut self, block: ast::BlockExpr) -> ExprId {
         block.statements().for_each(|s| self.collect_stmt(s));
         block.tail_expr().and_then(|e| {
             let expr = self.maybe_collect_expr(e)?;
-            Some(self.statements_in_scope.push(Statement::Expr { expr, has_semi: false }))
+            self.statements_in_scope.push(Statement::Expr { expr, has_semi: false });
+            Some(())
         });
 
         let mut tail = None;
@@ -1000,18 +999,18 @@ fn from(ast_lit_kind: ast::LiteralKind) -> Self {
             // FIXME: these should have actual values filled in, but unsure on perf impact
             LiteralKind::IntNumber(lit) => {
                 if let builtin @ Some(_) = lit.suffix().and_then(BuiltinFloat::from_suffix) {
-                    return Literal::Float(Default::default(), builtin);
+                    Literal::Float(Default::default(), builtin)
                 } else if let builtin @ Some(_) =
-                    lit.suffix().and_then(|it| BuiltinInt::from_suffix(&it))
+                    lit.suffix().and_then(|it| BuiltinInt::from_suffix(it))
                 {
                     Literal::Int(lit.value().unwrap_or(0) as i128, builtin)
                 } else {
-                    let builtin = lit.suffix().and_then(|it| BuiltinUint::from_suffix(&it));
+                    let builtin = lit.suffix().and_then(|it| BuiltinUint::from_suffix(it));
                     Literal::Uint(lit.value().unwrap_or(0), builtin)
                 }
             }
             LiteralKind::FloatNumber(lit) => {
-                let ty = lit.suffix().and_then(|it| BuiltinFloat::from_suffix(&it));
+                let ty = lit.suffix().and_then(|it| BuiltinFloat::from_suffix(it));
                 Literal::Float(Default::default(), ty)
             }
             LiteralKind::ByteString(bs) => {