Skip to content

Commit f338900

Browse files
Remove Drop-caused migration-added captures
All of these were added due to insignificant Drop types being present.
1 parent 5e344da commit f338900

File tree

9 files changed

+18
-30
lines changed

9 files changed

+18
-30
lines changed

compiler/rustc_infer/src/infer/at.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
195195
let Trace { at, trace, a_is_expected } = self;
196196
at.infcx.commit_if_ok(|_| {
197197
let mut fields = at.infcx.combine_fields(trace, at.param_env);
198-
fields.sub(a_is_expected).relate(a, b).map(move |_| {
199-
let _ = &fields;
200-
InferOk { value: (), obligations: fields.obligations }
201-
})
198+
fields
199+
.sub(a_is_expected)
200+
.relate(a, b)
201+
.map(move |_| InferOk { value: (), obligations: fields.obligations })
202202
})
203203
}
204204

@@ -212,10 +212,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
212212
let Trace { at, trace, a_is_expected } = self;
213213
at.infcx.commit_if_ok(|_| {
214214
let mut fields = at.infcx.combine_fields(trace, at.param_env);
215-
fields.equate(a_is_expected).relate(a, b).map(move |_| {
216-
let _ = &fields;
217-
InferOk { value: (), obligations: fields.obligations }
218-
})
215+
fields
216+
.equate(a_is_expected)
217+
.relate(a, b)
218+
.map(move |_| InferOk { value: (), obligations: fields.obligations })
219219
})
220220
}
221221

@@ -227,10 +227,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
227227
let Trace { at, trace, a_is_expected } = self;
228228
at.infcx.commit_if_ok(|_| {
229229
let mut fields = at.infcx.combine_fields(trace, at.param_env);
230-
fields.lub(a_is_expected).relate(a, b).map(move |t| {
231-
let _ = &fields;
232-
InferOk { value: t, obligations: fields.obligations }
233-
})
230+
fields
231+
.lub(a_is_expected)
232+
.relate(a, b)
233+
.map(move |t| InferOk { value: t, obligations: fields.obligations })
234234
})
235235
}
236236

@@ -242,10 +242,10 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
242242
let Trace { at, trace, a_is_expected } = self;
243243
at.infcx.commit_if_ok(|_| {
244244
let mut fields = at.infcx.combine_fields(trace, at.param_env);
245-
fields.glb(a_is_expected).relate(a, b).map(move |t| {
246-
let _ = &fields;
247-
InferOk { value: t, obligations: fields.obligations }
248-
})
245+
fields
246+
.glb(a_is_expected)
247+
.relate(a, b)
248+
.map(move |t| InferOk { value: t, obligations: fields.obligations })
249249
})
250250
}
251251
}

compiler/rustc_mir_build/src/lints.rs

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ crate fn check<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
4141
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
4242
let sp = tcx.sess.source_map().guess_head_span(tcx.hir().span_with_body(hir_id));
4343
tcx.struct_span_lint_hir(UNCONDITIONAL_RECURSION, hir_id, sp, |lint| {
44-
let _ = &vis;
4544
let mut db = lint.build("function cannot return without recursing");
4645
db.span_label(sp, "cannot return without recursing");
4746
// offer some help to the programmer.

compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ where
4040
info!("fully_perform({:?})", self);
4141
}
4242

43-
scrape_region_constraints(infcx, || {
44-
let _ = &self;
45-
(self.closure)(infcx)
46-
})
43+
scrape_region_constraints(infcx, || (self.closure)(infcx))
4744
}
4845
}
4946

compiler/rustc_trait_selection/src/traits/specialize/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ fn report_conflicting_impls(
394394
// now because the struct_lint methods don't return back the DiagnosticBuilder
395395
// that's passed in.
396396
let decorate = |err: LintDiagnosticBuilder<'_>| {
397-
let _ = &overlap;
398397
let msg = format!(
399398
"conflicting implementations of trait `{}`{}{}",
400399
overlap.trait_desc,

compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs

-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ impl ChildrenExt for Children {
105105

106106
// FIXME: should postpone string formatting until we decide to actually emit.
107107
with_no_trimmed_paths(|| {
108-
let _ = &overlap;
109108
OverlapError {
110109
with_impl: possible_sibling,
111110
trait_desc: trait_ref.print_only_trait_path().to_string(),

compiler/rustc_typeck/src/check/compare_method.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,6 @@ fn compare_type_predicate_entailment<'tcx>(
11921192
normalize_cause.clone(),
11931193
);
11941194
tcx.infer_ctxt().enter(|infcx| {
1195-
let _ = &impl_ty_own_bounds;
11961195
let inh = Inherited::new(infcx, impl_ty.def_id.expect_local());
11971196
let infcx = &inh.infcx;
11981197

compiler/rustc_typeck/src/check/method/probe.rs

-1
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
441441
// this creates one big transaction so that all type variables etc
442442
// that we create during the probe process are removed later
443443
self.probe(|_| {
444-
let _ = &steps;
445444
let mut probe_cx = ProbeContext::new(
446445
self,
447446
span,

src/librustdoc/doctest.rs

-1
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,6 @@ impl Tester for Collector {
964964
test_type: test::TestType::DocTest,
965965
},
966966
testfn: test::DynTestFn(Box::new(move || {
967-
let _ = &config;
968967
let report_unused_externs = |uext| {
969968
unused_externs.lock().unwrap().push(uext);
970969
};

src/tools/clippy/clippy_utils/src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -990,10 +990,7 @@ pub fn can_move_expr_to_closure(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) ->
990990
captures: HirIdMap::default(),
991991
};
992992
v.visit_expr(expr);
993-
v.allow_closure.then(|| {
994-
let _ = &v;
995-
v.captures
996-
})
993+
v.allow_closure.then(|| v.captures)
997994
}
998995

999996
/// Returns the method names and argument list of nested method call expressions that make up

0 commit comments

Comments
 (0)