Skip to content

Commit eca2789

Browse files
committed
remove useless local variables
1 parent 274b524 commit eca2789

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
@@ -215,8 +215,7 @@ fn do_mir_borrowck<'tcx>(
215215
nll::replace_regions_in_mir(&infcx, param_env, &mut body_owned, &mut promoted);
216216
let body = &body_owned; // no further changes
217217

218-
let location_table_owned = LocationTable::new(body);
219-
let location_table = &location_table_owned;
218+
let location_table = LocationTable::new(body);
220219

221220
let move_data = MoveData::gather_moves(body, tcx, param_env, |_| true);
222221
let promoted_move_data = promoted
@@ -248,7 +247,7 @@ fn do_mir_borrowck<'tcx>(
248247
free_regions,
249248
body,
250249
&promoted,
251-
location_table,
250+
&location_table,
252251
param_env,
253252
&mut flow_inits,
254253
&mdpe.move_data,
@@ -312,7 +311,7 @@ fn do_mir_borrowck<'tcx>(
312311
param_env,
313312
body: promoted_body,
314313
move_data: &move_data,
315-
location_table, // no need to create a real one for the promoted, it is not used
314+
location_table: &location_table, // no need to create a real one for the promoted, it is not used
316315
movable_coroutine,
317316
fn_self_span_reported: Default::default(),
318317
locals_are_invalidated_at_exit,
@@ -353,7 +352,7 @@ fn do_mir_borrowck<'tcx>(
353352
param_env,
354353
body,
355354
move_data: &mdpe.move_data,
356-
location_table,
355+
location_table: &location_table,
357356
movable_coroutine,
358357
locals_are_invalidated_at_exit,
359358
fn_self_span_reported: Default::default(),
@@ -455,7 +454,7 @@ fn do_mir_borrowck<'tcx>(
455454
promoted,
456455
borrow_set,
457456
region_inference_context: regioncx,
458-
location_table: polonius_input.as_ref().map(|_| location_table_owned),
457+
location_table: polonius_input.as_ref().map(|_| location_table),
459458
input_facts: polonius_input,
460459
output_facts,
461460
}))
@@ -1040,9 +1039,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10401039
flow_state: &Flows<'cx, 'tcx>,
10411040
) -> bool {
10421041
let mut error_reported = false;
1043-
let tcx = self.infcx.tcx;
1044-
let body = self.body;
1045-
let borrow_set = self.borrow_set.clone();
1042+
let borrow_set = Rc::clone(&self.borrow_set);
10461043

10471044
// Use polonius output if it has been enabled.
10481045
let mut polonius_output;
@@ -1059,8 +1056,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10591056

10601057
each_borrow_involving_path(
10611058
self,
1062-
tcx,
1063-
body,
1059+
self.infcx.tcx,
1060+
self.body,
10641061
location,
10651062
(sd, place_span.0),
10661063
&borrow_set,

0 commit comments

Comments
 (0)