File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
branches/try2/src/libcore Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
5
5
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
- refs/heads/try2: 45921648699a42fa1d257f6a54d2dbe9e46b0e20
8
+ refs/heads/try2: c5e0736c2434fbed6b7f249b42b336f0e27804a6
9
9
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -209,20 +209,20 @@ impl<'a> DoubleEndedIterator<char> for Chars<'a> {
209
209
/// Use with the `std::iter` module.
210
210
#[ deriving( Clone ) ]
211
211
pub struct CharOffsets < ' a > {
212
- front : uint ,
213
- back : uint ,
212
+ front_offset : uint ,
214
213
iter : Chars < ' a > ,
215
214
}
216
215
217
216
impl < ' a > Iterator < ( uint , char ) > for CharOffsets < ' a > {
218
217
#[ inline]
219
218
fn next ( & mut self ) -> Option < ( uint , char ) > {
219
+ let ( pre_len, _) = self . iter . iter . size_hint ( ) ;
220
220
match self . iter . next ( ) {
221
221
None => None ,
222
222
Some ( ch) => {
223
- let index = self . front ;
223
+ let index = self . front_offset ;
224
224
let ( len, _) = self . iter . iter . size_hint ( ) ;
225
- self . front += self . back - self . front - len;
225
+ self . front_offset += pre_len - len;
226
226
Some ( ( index, ch) )
227
227
}
228
228
}
@@ -241,8 +241,8 @@ impl<'a> DoubleEndedIterator<(uint, char)> for CharOffsets<'a> {
241
241
None => None ,
242
242
Some ( ch) => {
243
243
let ( len, _) = self . iter . iter . size_hint ( ) ;
244
- self . back - = self . back - self . front - len;
245
- Some ( ( self . back , ch) )
244
+ let index = self . front_offset + len;
245
+ Some ( ( index , ch) )
246
246
}
247
247
}
248
248
}
@@ -1680,7 +1680,7 @@ impl<'a> StrSlice<'a> for &'a str {
1680
1680
1681
1681
#[ inline]
1682
1682
fn char_indices ( & self ) -> CharOffsets < ' a > {
1683
- CharOffsets { front : 0 , back : self . len ( ) , iter : self . chars ( ) }
1683
+ CharOffsets { front_offset : 0 , iter : self . chars ( ) }
1684
1684
}
1685
1685
1686
1686
#[ inline]
You can’t perform that action at this time.
0 commit comments