We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ff1245 commit f70b5e1Copy full SHA for f70b5e1
library/alloc/src/str.rs
@@ -348,10 +348,10 @@ impl str {
348
Some(Utf8Pattern::CharPattern(c)) => c.as_ascii().map(|ascii_char| ascii_char.to_u8()),
349
_ => None,
350
} {
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
- }
+ if let Some(sref) = from_byte.as_ascii().map(|ascii_char| f(ascii_char.as_str()))
+ && let [to_byte] = sref.as_ref().as_bytes()
+ {
+ return unsafe { replace_ascii(self.as_bytes(), from_byte, *to_byte) };
355
}
356
357
0 commit comments