Skip to content

Commit b7e223d

Browse files
committed
collections: id_map: remove type annotations
Removed type annotations to reduce syntactic clutter.
1 parent 4b1be1b commit b7e223d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/collections/id_map/direct_map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ impl<E: Eq + Hash + From<u64> + Into<u64> + Copy, I: From<u64> + Into<u64> + Cop
2727

2828
#[inline(always)]
2929
pub fn insert_with_new_id(&mut self, internal_id: I) -> Option<E> {
30-
let higher_order_bits: u64 = self.generate_id() as u64;
30+
let higher_order_bits = self.generate_id() as u64;
3131
// Use random number for higher order bits and the offset for lower order bits.
32-
let external_id: u64 = higher_order_bits << 32 | <I as Into<u64>>::into(internal_id);
32+
let external_id = higher_order_bits << 32 | <I as Into<u64>>::into(internal_id);
3333
Some(external_id.into())
3434
}
3535

@@ -39,7 +39,7 @@ impl<E: Eq + Hash + From<u64> + Into<u64> + Copy, I: From<u64> + Into<u64> + Cop
3939
}
4040

4141
fn mask_id(external_id: &E) -> I {
42-
let masked_id: u32 = <E as Into<u64>>::into(*external_id) as u32;
42+
let masked_id = <E as Into<u64>>::into(*external_id) as u32;
4343
<I as From<u64>>::from(masked_id as u64)
4444
}
4545
}

src/collections/id_map/indirect_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<E: Eq + Hash + From<u64> + Into<u64> + Copy, I: From<u64> + Into<u64> + Cop
3939
pub fn insert_with_new_id(&mut self, internal_id: I) -> Option<E> {
4040
// Otherwise, allocate a new external id.
4141
for _ in 0..MAX_RETRIES_ID_ALLOC {
42-
let external_id: E = E::from(self.generate_id());
42+
let external_id = E::from(self.generate_id());
4343
if let Entry::Vacant(e) = self.ids.entry(external_id) {
4444
e.insert(internal_id);
4545
return Some(external_id);
@@ -76,7 +76,7 @@ impl<E: Eq + Hash + From<u32> + Into<u32> + Copy, I: From<u32> + Into<u32> + Cop
7676
/// until we find an unused id (up to a maximum number of tries).
7777
pub fn insert_with_new_id(&mut self, internal_id: I) -> Option<E> {
7878
for _ in 0..MAX_RETRIES_ID_ALLOC {
79-
let external_id: E = E::from(self.generate_id());
79+
let external_id = E::from(self.generate_id());
8080
if let Entry::Vacant(e) = self.ids.entry(external_id) {
8181
e.insert(internal_id);
8282
return Some(external_id);

0 commit comments

Comments
 (0)