Skip to content

Commit

Permalink
str: rm map_chars, replaced by iterators
Browse files Browse the repository at this point in the history
mapping a function against the elements should not require allocating a
new container, but `collect` still provides the functionality as-needed
  • Loading branch information
thestinger committed Sep 5, 2013
1 parent d285ea7 commit fcc7aff
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/libstd/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1370,8 +1370,6 @@ pub trait StrSlice<'self> {
fn slice_shift_char(&self) -> (char, &'self str);
fn map_chars(&self, ff: &fn(char) -> char) -> ~str;
fn lev_distance(&self, t: &str) -> uint;
fn subslice_offset(&self, inner: &str) -> uint;
Expand Down Expand Up @@ -2088,15 +2086,6 @@ impl<'self> StrSlice<'self> for &'self str {
return (ch, next_s);
}
/// Apply a function to each character.
fn map_chars(&self, ff: &fn(char) -> char) -> ~str {
let mut result = with_capacity(self.len());
for cc in self.iter() {
result.push_char(ff(cc));
}
result
}
/// Levenshtein Distance between two strings.
fn lev_distance(&self, t: &str) -> uint {
let slen = self.len();
Expand Down

5 comments on commit fcc7aff

@bors
Copy link
Contributor

@bors bors commented on fcc7aff Sep 5, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on fcc7aff Sep 5, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging thestinger/rust/str = fcc7aff into auto

@bors
Copy link
Contributor

@bors bors commented on fcc7aff Sep 5, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thestinger/rust/str = fcc7aff merged ok, testing candidate = 6f176a1

@bors
Copy link
Contributor

@bors bors commented on fcc7aff Sep 5, 2013

@bors
Copy link
Contributor

@bors bors commented on fcc7aff Sep 5, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 6f176a1

Please sign in to comment.