diff --git a/compiler/rustc_infer/src/infer/at.rs b/compiler/rustc_infer/src/infer/at.rs index 33ce8f5f97f..11ee8fb17ad 100644 --- a/compiler/rustc_infer/src/infer/at.rs +++ b/compiler/rustc_infer/src/infer/at.rs @@ -195,10 +195,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> { let Trace { at, trace, a_is_expected } = self; at.infcx.commit_if_ok(|_| { let mut fields = at.infcx.combine_fields(trace, at.param_env); - fields.sub(a_is_expected).relate(a, b).map(move |_| { - let _ = &fields; - InferOk { value: (), obligations: fields.obligations } - }) + fields + .sub(a_is_expected) + .relate(a, b) + .map(move |_| InferOk { value: (), obligations: fields.obligations }) }) } @@ -212,10 +212,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> { let Trace { at, trace, a_is_expected } = self; at.infcx.commit_if_ok(|_| { let mut fields = at.infcx.combine_fields(trace, at.param_env); - fields.equate(a_is_expected).relate(a, b).map(move |_| { - let _ = &fields; - InferOk { value: (), obligations: fields.obligations } - }) + fields + .equate(a_is_expected) + .relate(a, b) + .map(move |_| InferOk { value: (), obligations: fields.obligations }) }) } @@ -227,10 +227,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> { let Trace { at, trace, a_is_expected } = self; at.infcx.commit_if_ok(|_| { let mut fields = at.infcx.combine_fields(trace, at.param_env); - fields.lub(a_is_expected).relate(a, b).map(move |t| { - let _ = &fields; - InferOk { value: t, obligations: fields.obligations } - }) + fields + .lub(a_is_expected) + .relate(a, b) + .map(move |t| InferOk { value: t, obligations: fields.obligations }) }) } @@ -242,10 +242,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> { let Trace { at, trace, a_is_expected } = self; at.infcx.commit_if_ok(|_| { let mut fields = at.infcx.combine_fields(trace, at.param_env); - fields.glb(a_is_expected).relate(a, b).map(move |t| { - let _ = &fields; - InferOk { value: t, obligations: fields.obligations } - }) + fields + .glb(a_is_expected) + .relate(a, b) + .map(move |t| InferOk { value: t, obligations: fields.obligations }) }) } } diff --git a/compiler/rustc_mir_build/src/lints.rs b/compiler/rustc_mir_build/src/lints.rs index 2d408e577d1..ef8bd20d510 100644 --- a/compiler/rustc_mir_build/src/lints.rs +++ b/compiler/rustc_mir_build/src/lints.rs @@ -41,7 +41,6 @@ crate fn check<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) { let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); let sp = tcx.sess.source_map().guess_head_span(tcx.hir().span_with_body(hir_id)); tcx.struct_span_lint_hir(UNCONDITIONAL_RECURSION, hir_id, sp, |lint| { - let _ = &vis; let mut db = lint.build("function cannot return without recursing"); db.span_label(sp, "cannot return without recursing"); // offer some help to the programmer. diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs index 8ee217655d9..b5398f8a435 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs @@ -40,10 +40,7 @@ where info!("fully_perform({:?})", self); } - scrape_region_constraints(infcx, || { - let _ = &self; - (self.closure)(infcx) - }) + scrape_region_constraints(infcx, || (self.closure)(infcx)) } } diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs index 36fe0594983..88aca794a6b 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs @@ -394,7 +394,6 @@ fn report_conflicting_impls( // now because the struct_lint methods don't return back the DiagnosticBuilder // that's passed in. let decorate = |err: LintDiagnosticBuilder<'_>| { - let _ = &overlap; let msg = format!( "conflicting implementations of trait `{}`{}{}", overlap.trait_desc, diff --git a/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs b/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs index c3e5b79c8f4..2ecc169e1cf 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs @@ -105,7 +105,6 @@ impl ChildrenExt for Children { // FIXME: should postpone string formatting until we decide to actually emit. with_no_trimmed_paths(|| { - let _ = &overlap; OverlapError { with_impl: possible_sibling, trait_desc: trait_ref.print_only_trait_path().to_string(), diff --git a/compiler/rustc_typeck/src/check/compare_method.rs b/compiler/rustc_typeck/src/check/compare_method.rs index b359e8b2ebe..d5b631df058 100644 --- a/compiler/rustc_typeck/src/check/compare_method.rs +++ b/compiler/rustc_typeck/src/check/compare_method.rs @@ -1192,7 +1192,6 @@ fn compare_type_predicate_entailment<'tcx>( normalize_cause.clone(), ); tcx.infer_ctxt().enter(|infcx| { - let _ = &impl_ty_own_bounds; let inh = Inherited::new(infcx, impl_ty.def_id.expect_local()); let infcx = &inh.infcx; diff --git a/compiler/rustc_typeck/src/check/method/probe.rs b/compiler/rustc_typeck/src/check/method/probe.rs index 56b15883013..cbfdce96bc5 100644 --- a/compiler/rustc_typeck/src/check/method/probe.rs +++ b/compiler/rustc_typeck/src/check/method/probe.rs @@ -441,7 +441,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // this creates one big transaction so that all type variables etc // that we create during the probe process are removed later self.probe(|_| { - let _ = &steps; let mut probe_cx = ProbeContext::new( self, span, diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 71bdfdd4ade..dbeea9cddf3 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -964,7 +964,6 @@ impl Tester for Collector { test_type: test::TestType::DocTest, }, testfn: test::DynTestFn(Box::new(move || { - let _ = &config; let report_unused_externs = |uext| { unused_externs.lock().unwrap().push(uext); }; diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 5c505f6851a..3a94f472983 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -990,10 +990,7 @@ pub fn can_move_expr_to_closure(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> captures: HirIdMap::default(), }; v.visit_expr(expr); - v.allow_closure.then(|| { - let _ = &v; - v.captures - }) + v.allow_closure.then(|| v.captures) } /// Returns the method names and argument list of nested method call expressions that make up