Skip to content

Commit 2b96079

Browse files
committed
remove useless local variables
1 parent fc13ca6 commit 2b96079

File tree

1 file changed

+8
-11
lines changed
  • compiler/rustc_borrowck/src

1 file changed

+8
-11
lines changed

compiler/rustc_borrowck/src/lib.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ fn do_mir_borrowck<'tcx>(
216216
nll::replace_regions_in_mir(&infcx, param_env, &mut body_owned, &mut promoted);
217217
let body = &body_owned; // no further changes
218218

219-
let location_table_owned = LocationTable::new(body);
220-
let location_table = &location_table_owned;
219+
let location_table = LocationTable::new(body);
221220

222221
let move_data = MoveData::gather_moves(body, tcx, param_env, |_| true);
223222
let promoted_move_data = promoted
@@ -249,7 +248,7 @@ fn do_mir_borrowck<'tcx>(
249248
free_regions,
250249
body,
251250
&promoted,
252-
location_table,
251+
&location_table,
253252
param_env,
254253
&mut flow_inits,
255254
&mdpe.move_data,
@@ -313,7 +312,7 @@ fn do_mir_borrowck<'tcx>(
313312
param_env,
314313
body: promoted_body,
315314
move_data: &move_data,
316-
location_table, // no need to create a real one for the promoted, it is not used
315+
location_table: &location_table, // no need to create a real one for the promoted, it is not used
317316
movable_coroutine,
318317
fn_self_span_reported: Default::default(),
319318
locals_are_invalidated_at_exit,
@@ -354,7 +353,7 @@ fn do_mir_borrowck<'tcx>(
354353
param_env,
355354
body,
356355
move_data: &mdpe.move_data,
357-
location_table,
356+
location_table: &location_table,
358357
movable_coroutine,
359358
locals_are_invalidated_at_exit,
360359
fn_self_span_reported: Default::default(),
@@ -456,7 +455,7 @@ fn do_mir_borrowck<'tcx>(
456455
promoted,
457456
borrow_set,
458457
region_inference_context: regioncx,
459-
location_table: polonius_input.as_ref().map(|_| location_table_owned),
458+
location_table: polonius_input.as_ref().map(|_| location_table),
460459
input_facts: polonius_input,
461460
output_facts,
462461
}))
@@ -1041,9 +1040,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10411040
flow_state: &Flows<'cx, 'tcx>,
10421041
) -> bool {
10431042
let mut error_reported = false;
1044-
let tcx = self.infcx.tcx;
1045-
let body = self.body;
1046-
let borrow_set = self.borrow_set.clone();
1043+
let borrow_set = Rc::clone(&self.borrow_set);
10471044

10481045
// Use polonius output if it has been enabled.
10491046
let mut polonius_output;
@@ -1060,8 +1057,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10601057

10611058
each_borrow_involving_path(
10621059
self,
1063-
tcx,
1064-
body,
1060+
self.infcx.tcx,
1061+
self.body,
10651062
location,
10661063
(sd, place_span.0),
10671064
&borrow_set,

0 commit comments

Comments
 (0)