Skip to content

Commit d65abc2

Browse files
committed
Fix clippy::option_if_let_else warnings
1 parent 887a076 commit d65abc2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@
143143
#![warn(
144144
clippy::use_self,
145145
clippy::too_long_first_doc_paragraph,
146-
clippy::redundant_pub_crate
146+
clippy::redundant_pub_crate,
147+
clippy::option_if_let_else
147148
)]
148149

149150
pub use binary_heap::BinaryHeap;

src/string/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,10 +581,10 @@ impl<S: VecStorage<u8> + ?Sized> StringInner<S> {
581581
/// ```
582582
#[inline]
583583
pub fn remove(&mut self, index: usize) -> char {
584-
let ch = match self[index..].chars().next() {
585-
Some(ch) => ch,
586-
None => panic!("cannot remove a char from the end of a string"),
587-
};
584+
let ch = self[index..]
585+
.chars()
586+
.next()
587+
.unwrap_or_else(|| panic!("cannot remove a char from the end of a string"));
588588

589589
let next = index + ch.len_utf8();
590590
let len = self.len();

0 commit comments

Comments
 (0)