diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-26 17:02:00 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-26 17:02:00 +0100 |
commit | 1dd3d9bc2d328e164c594f3d2022dcf174f907a9 (patch) | |
tree | e4d7f73b0253fb882ac043dd75a111fcaf487c27 /crates/ra_arena/src | |
parent | 42c4e0f378faeabd425392d4a7a7839bd7e8ac2f (diff) | |
parent | d8649c1af86118dea6b6340c999b5864a8d55279 (diff) |
Merge #1212
1212: Clippy cleanups r=matklad a=kjeremy
Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_arena/src')
-rw-r--r-- | crates/ra_arena/src/lib.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ra_arena/src/lib.rs b/crates/ra_arena/src/lib.rs index 1c97c2662..26641e690 100644 --- a/crates/ra_arena/src/lib.rs +++ b/crates/ra_arena/src/lib.rs | |||
@@ -71,12 +71,15 @@ impl<ID: ArenaId, T> Arena<ID, T> { | |||
71 | pub fn len(&self) -> usize { | 71 | pub fn len(&self) -> usize { |
72 | self.data.len() | 72 | self.data.len() |
73 | } | 73 | } |
74 | pub fn is_empty(&self) -> bool { | ||
75 | self.data.is_empty() | ||
76 | } | ||
74 | pub fn alloc(&mut self, value: T) -> ID { | 77 | pub fn alloc(&mut self, value: T) -> ID { |
75 | let id = RawId(self.data.len() as u32); | 78 | let id = RawId(self.data.len() as u32); |
76 | self.data.push(value); | 79 | self.data.push(value); |
77 | ID::from_raw(id) | 80 | ID::from_raw(id) |
78 | } | 81 | } |
79 | pub fn iter<'a>(&'a self) -> impl Iterator<Item = (ID, &'a T)> { | 82 | pub fn iter(&self) -> impl Iterator<Item = (ID, &T)> { |
80 | self.data.iter().enumerate().map(|(idx, value)| (ID::from_raw(RawId(idx as u32)), value)) | 83 | self.data.iter().enumerate().map(|(idx, value)| (ID::from_raw(RawId(idx as u32)), value)) |
81 | } | 84 | } |
82 | } | 85 | } |