Skip to content

Commit 2a8ad06

Browse files
Rollup merge of #88850 - matthiaskrgr:identical_conv, r=jackh726
don't convert types into identical types example: let x: String = String::new().into();
2 parents c2e1097 + 545d8d6 commit 2a8ad06

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

compiler/rustc_hir_pretty/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ impl<'a> State<'a> {
10361036
self.maybe_print_comment(st.span.lo());
10371037
match st.kind {
10381038
hir::StmtKind::Local(ref loc) => {
1039-
self.print_local(loc.init.as_deref(), |this| this.print_local_decl(&loc));
1039+
self.print_local(loc.init, |this| this.print_local_decl(&loc));
10401040
}
10411041
hir::StmtKind::Item(item) => self.ann.nested(self, Nested::Item(item)),
10421042
hir::StmtKind::Expr(ref expr) => {

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2345,7 +2345,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
23452345
);
23462346
err.span_suggestion(
23472347
generics.where_clause.tail_span_for_suggestion(),
2348-
"consider adding a where clause".into(),
2348+
"consider adding a where clause",
23492349
suggestion,
23502350
Applicability::MaybeIncorrect,
23512351
);

compiler/rustc_passes/src/liveness.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
775775
if blk.targeted_by_break {
776776
self.break_ln.insert(blk.hir_id, succ);
777777
}
778-
let succ = self.propagate_through_opt_expr(blk.expr.as_deref(), succ);
778+
let succ = self.propagate_through_opt_expr(blk.expr, succ);
779779
blk.stmts.iter().rev().fold(succ, |succ, stmt| self.propagate_through_stmt(stmt, succ))
780780
}
781781

@@ -796,7 +796,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
796796
// initialization, which is mildly more complex than checking
797797
// once at the func header but otherwise equivalent.
798798

799-
let succ = self.propagate_through_opt_expr(local.init.as_deref(), succ);
799+
let succ = self.propagate_through_opt_expr(local.init, succ);
800800
self.define_bindings_in_pat(&local.pat, succ)
801801
}
802802
hir::StmtKind::Item(..) => succ,

compiler/rustc_passes/src/region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
812812
resolve_expr(self, ex);
813813
}
814814
fn visit_local(&mut self, l: &'tcx Local<'tcx>) {
815-
resolve_local(self, Some(&l.pat), l.init.as_deref());
815+
resolve_local(self, Some(&l.pat), l.init);
816816
}
817817
}
818818

0 commit comments

Comments
 (0)