We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 58ab407 + 696a7a1 commit dcdf1ecCopy full SHA for dcdf1ec
1 file changed
compiler/rustc_data_structures/src/sync/vec.rs
@@ -46,20 +46,17 @@ impl<T: Copy> AppendOnlyVec<T> {
46
}
47
48
pub fn iter_enumerated(&self) -> impl Iterator<Item = (usize, T)> {
49
- (0..)
50
- .map(|i| (i, self.get(i)))
51
- .take_while(|(_, o)| o.is_some())
52
- .filter_map(|(i, o)| Some((i, o?)))
+ (0..).map_while(|i| Some((i, self.get(i)?)))
53
54
55
pub fn iter(&self) -> impl Iterator<Item = T> {
56
- (0..).map(|i| self.get(i)).take_while(|o| o.is_some()).flatten()
+ (0..).map_while(|i| self.get(i))
57
58
59
60
impl<T: Copy + PartialEq> AppendOnlyVec<T> {
61
pub fn contains(&self, val: T) -> bool {
62
- self.iter_enumerated().any(|(_, v)| v == val)
+ self.iter().any(|v| v == val)
63
64
65
0 commit comments