Skip to content

Commit 727bd7d

Browse files
committed
libcore: Prefer Option::map over match where applicable
1 parent 4f3ab49 commit 727bd7d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/libcore/str/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -696,13 +696,10 @@ impl<'a> Iterator for CharIndices<'a> {
696696
impl<'a> DoubleEndedIterator for CharIndices<'a> {
697697
#[inline]
698698
fn next_back(&mut self) -> Option<(usize, char)> {
699-
match self.iter.next_back() {
700-
None => None,
701-
Some(ch) => {
702-
let index = self.front_offset + self.iter.iter.len();
703-
Some((index, ch))
704-
}
705-
}
699+
self.iter.next_back().map(|ch| {
700+
let index = self.front_offset + self.iter.iter.len();
701+
(index, ch)
702+
})
706703
}
707704
}
708705

0 commit comments

Comments
 (0)