Showing the changes to git-config/src (1 of 1 file). Show all
Unified · Split
| @@ -222,7 +222,7 @@ impl<'borrow, 'event> MutableSection<'borrow, 'event> { · 221 unmodified lines | ||
| 222 | 222 | self.section.0.drain(start..=end); |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | − fn set(&mut self, index: usize, key: Key<'event>, value: Vec<u8>) { | |
| 225 | + fn set_internal(&mut self, index: usize, key: Key<'event>, value: Vec<u8>) { | |
| 226 | 226 | self.section |
| 227 | 227 | .0 |
| 228 | 228 | .insert(index, Event::Value(Cow::Owned(value))); |
| @@ -350,8 +350,10 @@ impl<'event> SectionBody<'event> { · 121 unmodified lines | ||
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | /// Returns an iterator visiting all keys in order. |
| 353 | − pub fn keys(&self) -> impl Iterator<Item = &Event<'event>> { | |
| 354 | − self.0.iter().filter(|e| matches!(e, Event::Key(_))) | |
| 353 | + pub fn keys(&self) -> impl Iterator<Item = &Key<'event>> { | |
| 354 | + self.0 | |
| 355 | + .iter() | |
| 356 | + .filter_map(|e| if let Event::Key(k) = e { Some(k) } else { None }) | |
| 355 | 357 | } |
| 356 | 358 | |
| 357 | 359 | /// Checks if the section contains the provided key. |
| @@ -825,7 +827,7 @@ impl MutableValue<'_, '_, '_> { · 467 unmodified lines | ||
| 825 | 827 | } |
| 826 | 828 | self.size = 3; |
| 827 | 829 | self.section |
| 828 | − .set(self.index, Key(Cow::Owned(self.key.to_string())), input); | |
| 830 | + .set_internal(self.index, Key(Cow::Owned(self.key.to_string())), input); | |
| 829 | 831 | } |
| 830 | 832 | |
| 831 | 833 | /// Removes the value. Does nothing when called multiple times in |