File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
branches/try/src/libcore/str Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
3
3
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4
- refs/heads/try: 80e7a1be359fc0de4eb17056230ae2fc130b7090
4
+ refs/heads/try: f621193e5ea7ac54fcd37f0e730e955fd9f61200
5
5
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
6
6
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
7
7
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -1892,7 +1892,10 @@ impl StrExt for str {
1892
1892
1893
1893
#[ inline]
1894
1894
fn is_char_boundary ( & self , index : usize ) -> bool {
1895
- if index == self . len ( ) { return true ; }
1895
+ // 0 and len are always ok.
1896
+ // Test for 0 explicitly so that it can optimize out the check
1897
+ // easily and skip reading string data for that case.
1898
+ if index == 0 || index == self . len ( ) { return true ; }
1896
1899
match self . as_bytes ( ) . get ( index) {
1897
1900
None => false ,
1898
1901
Some ( & b) => b < 128 || b >= 192 ,
You can’t perform that action at this time.
0 commit comments