Skip to content

Commit f70b5e1

Browse files
committed
turn the nested if-let expressions into an if-let-chain
1 parent 4ff1245 commit f70b5e1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎library/alloc/src/str.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,10 @@ impl str {
348348
Some(Utf8Pattern::CharPattern(c)) => c.as_ascii().map(|ascii_char| ascii_char.to_u8()),
349349
_ => None,
350350
} {
351-
if let Some(sref) = from_byte.as_ascii().map(|ascii_char| f(ascii_char.as_str())) {
352-
if let [to_byte] = sref.as_ref().as_bytes() {
353-
return unsafe { replace_ascii(self.as_bytes(), from_byte, *to_byte) };
354-
}
351+
if let Some(sref) = from_byte.as_ascii().map(|ascii_char| f(ascii_char.as_str()))
352+
&& let [to_byte] = sref.as_ref().as_bytes()
353+
{
354+
return unsafe { replace_ascii(self.as_bytes(), from_byte, *to_byte) };
355355
}
356356
}
357357

0 commit comments

Comments
 (0)