Skip to content

Commit b2816c7

Browse files
committed
libstd: Fix merge fallout.
1 parent b4f8373 commit b2816c7

File tree

1 file changed

+5
-66
lines changed

1 file changed

+5
-66
lines changed

src/libstd/str.rs

Lines changed: 5 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -538,13 +538,13 @@ pub struct StrStrSplitIterator<'self> {
538538
priv finished: bool
539539
}
540540

541-
<<<<<<< HEAD
542541
impl<'self> Iterator<(uint, uint)> for StrMatchesIndexIterator<'self> {
543542
#[inline]
544543
fn next(&mut self) -> Option<(uint, uint)> {
545544
// See Issue #1932 for why this is a naive search
546545
let (h_len, n_len) = (self.haystack.len(), self.needle.len());
547-
let mut (match_start, match_i) = (0, 0);
546+
let mut match_start = 0;
547+
let mut match_i = 0;
548548

549549
while self.position < h_len {
550550
if self.haystack[self.position] == self.needle[match_i] {
@@ -561,24 +561,6 @@ impl<'self> Iterator<(uint, uint)> for StrMatchesIndexIterator<'self> {
561561
if match_i > 0 {
562562
match_i = 0;
563563
self.position = match_start;
564-
=======
565-
fn each_split_inner<'a>(s: &'a str,
566-
sepfn: &fn(cc: char) -> bool,
567-
count: uint,
568-
allow_empty: bool,
569-
allow_trailing_empty: bool,
570-
it: &fn(&'a str) -> bool) -> bool {
571-
let l = len(s);
572-
let mut i = 0u;
573-
let mut start = 0u;
574-
let mut done = 0u;
575-
while i < l && done < count {
576-
let CharRange {ch, next} = char_range_at(s, i);
577-
if sepfn(ch) {
578-
if allow_empty || start < i {
579-
if !it( unsafe{ raw::slice_bytes(s, start, i) } ) {
580-
return false;
581-
>>>>>>> librustc: Disallow "mut" from distributing over bindings.
582564
}
583565
self.position += 1;
584566
}
@@ -587,7 +569,6 @@ fn each_split_inner<'a>(s: &'a str,
587569
}
588570
}
589571

590-
<<<<<<< HEAD
591572
impl<'self> Iterator<&'self str> for StrStrSplitIterator<'self> {
592573
#[inline]
593574
fn next(&mut self) -> Option<&'self str> {
@@ -598,25 +579,6 @@ impl<'self> Iterator<&'self str> for StrStrSplitIterator<'self> {
598579
let ret = Some(self.it.haystack.slice(self.last_end, from));
599580
self.last_end = to;
600581
ret
601-
=======
602-
// See Issue #1932 for why this is a naive search
603-
fn iter_matches<'a,'b>(s: &'a str, sep: &'b str,
604-
f: &fn(uint, uint) -> bool) -> bool {
605-
let (sep_len, l) = (len(sep), len(s));
606-
assert!(sep_len > 0u);
607-
let mut i = 0u;
608-
let mut match_start = 0u;
609-
let mut match_i = 0u;
610-
611-
while i < l {
612-
if s[i] == sep[match_i] {
613-
if match_i == 0u { match_start = i; }
614-
match_i += 1u;
615-
// Found a match
616-
if match_i == sep_len {
617-
if !f(match_start, i + 1u) { return false; }
618-
match_i = 0u;
619-
>>>>>>> librustc: Disallow "mut" from distributing over bindings.
620582
}
621583
None => {
622584
self.finished = true;
@@ -762,23 +724,12 @@ pub fn each_split_within<'a>(ss: &'a str,
762724
* The original string with all occurances of `from` replaced with `to`
763725
*/
764726
pub fn replace(s: &str, from: &str, to: &str) -> ~str {
765-
<<<<<<< HEAD
766-
let mut (result, last_end) = (~"", 0);
727+
let mut result = ~"";
728+
let mut last_end = 0;
767729
for s.matches_index_iter(from).advance |(start, end)| {
768730
result.push_str(unsafe{raw::slice_bytes(s, last_end, start)});
769731
result.push_str(to);
770732
last_end = end;
771-
=======
772-
let mut result = ~"";
773-
let mut first = true;
774-
for iter_between_matches(s, from) |start, end| {
775-
if first {
776-
first = false;
777-
} else {
778-
push_str(&mut result, to);
779-
}
780-
push_str(&mut result, unsafe{raw::slice_bytes(s, start, end)});
781-
>>>>>>> librustc: Disallow "mut" from distributing over bindings.
782733
}
783734
result.push_str(unsafe{raw::slice_bytes(s, last_end, s.len())});
784735
result
@@ -1167,16 +1118,10 @@ pub fn with_capacity(capacity: uint) -> ~str {
11671118
* The number of Unicode characters in `s` between the given indices.
11681119
*/
11691120
pub fn count_chars(s: &str, start: uint, end: uint) -> uint {
1170-
<<<<<<< HEAD
11711121
assert!(s.is_char_boundary(start));
11721122
assert!(s.is_char_boundary(end));
1173-
let mut (i, len) = (start, 0u);
1174-
=======
1175-
assert!(is_char_boundary(s, start));
1176-
assert!(is_char_boundary(s, end));
11771123
let mut i = start;
11781124
let mut len = 0u;
1179-
>>>>>>> librustc: Disallow "mut" from distributing over bindings.
11801125
while i < end {
11811126
let next = s.char_range_at(i).next;
11821127
len += 1u;
@@ -1188,16 +1133,10 @@ pub fn count_chars(s: &str, start: uint, end: uint) -> uint {
11881133
/// Counts the number of bytes taken by the first `n` chars in `s`
11891134
/// starting from `start`.
11901135
pub fn count_bytes<'b>(s: &'b str, start: uint, n: uint) -> uint {
1191-
<<<<<<< HEAD
11921136
assert!(s.is_char_boundary(start));
1193-
let mut (end, cnt) = (start, n);
1194-
let l = s.len();
1195-
=======
1196-
assert!(is_char_boundary(s, start));
11971137
let mut end = start;
11981138
let mut cnt = n;
1199-
let l = len(s);
1200-
>>>>>>> librustc: Disallow "mut" from distributing over bindings.
1139+
let l = s.len();
12011140
while cnt > 0u {
12021141
assert!(end < l);
12031142
let next = s.char_range_at(end).next;

0 commit comments

Comments
 (0)