]> git.lizzy.rs Git - rust.git/commitdiff
don't convert types into identical types
authorMatthias Krüger <matthias.krueger@famsik.de>
Sat, 11 Sep 2021 08:31:56 +0000 (10:31 +0200)
committerMatthias Krüger <matthias.krueger@famsik.de>
Sat, 11 Sep 2021 08:32:38 +0000 (10:32 +0200)
example: let x: String = String::new().into();

compiler/rustc_hir_pretty/src/lib.rs
compiler/rustc_infer/src/infer/error_reporting/mod.rs
compiler/rustc_passes/src/liveness.rs
compiler/rustc_passes/src/region.rs

index 36054c0484782016fd0bb57c1f151d383a76d610..67f92bc0a51a7b8a161f792589e49ce9227441bb 100644 (file)
@@ -1036,7 +1036,7 @@ pub fn print_stmt(&mut self, st: &hir::Stmt<'_>) {
         self.maybe_print_comment(st.span.lo());
         match st.kind {
             hir::StmtKind::Local(ref loc) => {
-                self.print_local(loc.init.as_deref(), |this| this.print_local_decl(&loc));
+                self.print_local(loc.init, |this| this.print_local_decl(&loc));
             }
             hir::StmtKind::Item(item) => self.ann.nested(self, Nested::Item(item)),
             hir::StmtKind::Expr(ref expr) => {
index 32150c7f4c615dfc18f5bd70481fc7ba5ba24dbd..1139b714d0a1ff155b8055258a14dae507ad88d3 100644 (file)
@@ -2345,7 +2345,7 @@ enum SubOrigin<'hir> {
                 );
                 err.span_suggestion(
                     generics.where_clause.tail_span_for_suggestion(),
-                    "consider adding a where clause".into(),
+                    "consider adding a where clause",
                     suggestion,
                     Applicability::MaybeIncorrect,
                 );
index ab9bfea96943f3eafe4505a4c7660d61bdfdf205..0d7abeba1a703c003cfbb13c05eb276d7c4c76b8 100644 (file)
@@ -775,7 +775,7 @@ fn propagate_through_block(&mut self, blk: &hir::Block<'_>, succ: LiveNode) -> L
         if blk.targeted_by_break {
             self.break_ln.insert(blk.hir_id, succ);
         }
-        let succ = self.propagate_through_opt_expr(blk.expr.as_deref(), succ);
+        let succ = self.propagate_through_opt_expr(blk.expr, succ);
         blk.stmts.iter().rev().fold(succ, |succ, stmt| self.propagate_through_stmt(stmt, succ))
     }
 
@@ -796,7 +796,7 @@ fn propagate_through_stmt(&mut self, stmt: &hir::Stmt<'_>, succ: LiveNode) -> Li
                 // initialization, which is mildly more complex than checking
                 // once at the func header but otherwise equivalent.
 
-                let succ = self.propagate_through_opt_expr(local.init.as_deref(), succ);
+                let succ = self.propagate_through_opt_expr(local.init, succ);
                 self.define_bindings_in_pat(&local.pat, succ)
             }
             hir::StmtKind::Item(..) => succ,
index 08702cad41c8b92b5e0a80676f16dd22d6e5b6c0..5fc8e230d72a3eba67aca78d8a258115f9d21e31 100644 (file)
@@ -812,7 +812,7 @@ fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) {
         resolve_expr(self, ex);
     }
     fn visit_local(&mut self, l: &'tcx Local<'tcx>) {
-        resolve_local(self, Some(&l.pat), l.init.as_deref());
+        resolve_local(self, Some(&l.pat), l.init);
     }
 }