From 6344a7f362b19eaf71547766135ece160aa3389e Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Mon, 10 Aug 2020 15:05:01 +0300 Subject: Fix clippy warnings --- crates/ra_arena/src/map.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ra_arena') diff --git a/crates/ra_arena/src/map.rs b/crates/ra_arena/src/map.rs index 0f33907c0..c1b58712c 100644 --- a/crates/ra_arena/src/map.rs +++ b/crates/ra_arena/src/map.rs @@ -13,18 +13,18 @@ pub struct ArenaMap { impl ArenaMap, V> { pub fn insert(&mut self, id: Idx, t: V) { - let idx = Self::to_idx(id); + let idx = Self::into_idx(id); self.v.resize_with((idx + 1).max(self.v.len()), || None); self.v[idx] = Some(t); } pub fn get(&self, id: Idx) -> Option<&V> { - self.v.get(Self::to_idx(id)).and_then(|it| it.as_ref()) + self.v.get(Self::into_idx(id)).and_then(|it| it.as_ref()) } pub fn get_mut(&mut self, id: Idx) -> Option<&mut V> { - self.v.get_mut(Self::to_idx(id)).and_then(|it| it.as_mut()) + self.v.get_mut(Self::into_idx(id)).and_then(|it| it.as_mut()) } pub fn values(&self) -> impl Iterator { @@ -39,7 +39,7 @@ impl ArenaMap, V> { self.v.iter().enumerate().filter_map(|(idx, o)| Some((Self::from_idx(idx), o.as_ref()?))) } - fn to_idx(id: Idx) -> usize { + fn into_idx(id: Idx) -> usize { u32::from(id.into_raw()) as usize } @@ -51,7 +51,7 @@ impl ArenaMap, V> { impl std::ops::Index> for ArenaMap, T> { type Output = T; fn index(&self, id: Idx) -> &T { - self.v[Self::to_idx(id)].as_ref().unwrap() + self.v[Self::into_idx(id)].as_ref().unwrap() } } -- cgit v1.2.3