Skip to content

Commit 2d7426b

Browse files
committed
borrow_set: remove a helper function and a clone it uses
1 parent ddd4b19 commit 2d7426b

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/librustc_mir/borrow_check/borrow_set.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use rustc::util::nodemap::{FxHashMap, FxHashSet};
2121
use rustc_data_structures::indexed_vec::IndexVec;
2222
use rustc_data_structures::bit_set::BitSet;
2323
use std::fmt;
24-
use std::hash::Hash;
2524
use std::ops::Index;
2625

2726
crate struct BorrowSet<'tcx> {
@@ -233,21 +232,13 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> {
233232

234233
self.insert_as_pending_if_two_phase(location, &assigned_place, region, kind, idx);
235234

236-
insert(&mut self.region_map, &region, idx);
235+
self.region_map.entry(region).or_default().insert(idx);
237236
if let Some(local) = borrowed_place.root_local() {
238-
insert(&mut self.local_map, &local, idx);
237+
self.local_map.entry(local).or_default().insert(idx);
239238
}
240239
}
241240

242-
return self.super_assign(block, assigned_place, rvalue, location);
243-
244-
fn insert<'a, K, V>(map: &'a mut FxHashMap<K, FxHashSet<V>>, k: &K, v: V)
245-
where
246-
K: Clone + Eq + Hash,
247-
V: Eq + Hash,
248-
{
249-
map.entry(k.clone()).or_default().insert(v);
250-
}
241+
self.super_assign(block, assigned_place, rvalue, location)
251242
}
252243

253244
fn visit_place(

0 commit comments

Comments
 (0)