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 49920bc commit 2ea0410Copy full SHA for 2ea0410
library/core/src/str/mod.rs
@@ -195,11 +195,11 @@ impl str {
195
// 0 and len are always ok.
196
// Test for 0 explicitly so that it can optimize out the check
197
// easily and skip reading string data for that case.
198
- if index == 0 || index == self.len() {
+ if index == 0 {
199
return true;
200
}
201
match self.as_bytes().get(index) {
202
- None => false,
+ None => index == self.len(),
203
// This is bit magic equivalent to: b < 128 || b >= 192
204
Some(&b) => (b as i8) >= -0x40,
205
0 commit comments