diff options
| author | Jubilee <46493976+workingjubilee@users.noreply.github.com> | 2021-09-11 08:23:46 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-11 08:23:46 -0700 |
| commit | 2a8ad06689266d3959f35e407f8b6b2047a2457e (patch) | |
| tree | 4bd8ff3b37565cf6e4f43cfec62d63bfebc3f608 | |
| parent | c2e1097f44acfceb862d45ce7ca5b0c10de8cbb3 (diff) | |
| parent | 545d8d675c44a3b6fb4b840aca17fc34e885e353 (diff) | |
| download | rust-2a8ad06689266d3959f35e407f8b6b2047a2457e.tar.gz rust-2a8ad06689266d3959f35e407f8b6b2047a2457e.zip | |
Rollup merge of #88850 - matthiaskrgr:identical_conv, r=jackh726
don't convert types into identical types example: let x: String = String::new().into();
| -rw-r--r-- | compiler/rustc_hir_pretty/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/infer/error_reporting/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/liveness.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/region.rs | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 36054c04847..67f92bc0a51 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -1036,7 +1036,7 @@ impl<'a> State<'a> { 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) => { diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 32150c7f4c6..1139b714d0a 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -2345,7 +2345,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { ); err.span_suggestion( generics.where_clause.tail_span_for_suggestion(), - "consider adding a where clause".into(), + "consider adding a where clause", suggestion, Applicability::MaybeIncorrect, ); diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index ab9bfea9694..0d7abeba1a7 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -775,7 +775,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { 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 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { // 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, diff --git a/compiler/rustc_passes/src/region.rs b/compiler/rustc_passes/src/region.rs index 08702cad41c..5fc8e230d72 100644 --- a/compiler/rustc_passes/src/region.rs +++ b/compiler/rustc_passes/src/region.rs @@ -812,7 +812,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'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); } } |
