turn the nested if-let expressions into an if-let-chain · rust-lang/rust@f70b5e1 (original) (raw)

Original file line number Diff line number Diff line change
@@ -348,10 +348,10 @@ impl str {
348 348 Some(Utf8Pattern::CharPattern(c)) => c.as_ascii().map(|ascii_char
349 349 _ => None,
350 350 } {
351 -if let Some(sref) = from_byte.as_ascii().map(|ascii_char
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
352 +&& let [to_byte] = sref.as_ref().as_bytes()
353 +{
354 +return unsafe { replace_ascii(self.as_bytes(), from_byte, *to_byte) };
355 355 }
356 356 }
357 357