diff options
| author | Marvin Löbel <loebel.marvin@gmail.com> | 2013-03-21 22:59:33 +0100 |
|---|---|---|
| committer | Marvin Löbel <loebel.marvin@gmail.com> | 2013-03-21 23:06:04 +0100 |
| commit | ee2f3d9673407db3ca5a0eb24e01ef52c7fc676c (patch) | |
| tree | f85fe06cfa6bfab47ddfe9c55e9c91c2a67495d6 /src/libstd | |
| parent | ed25a674ac6bc53c9ee9f8c1cce21541f6811d4b (diff) | |
| download | rust-ee2f3d9673407db3ca5a0eb24e01ef52c7fc676c.tar.gz rust-ee2f3d9673407db3ca5a0eb24e01ef52c7fc676c.zip | |
Switched over substr and trim functions in str to be non-allocating, temporary renamed them to better track use-sites
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/bigint.rs | 5 | ||||
| -rw-r--r-- | src/libstd/semver.rs | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/libstd/bigint.rs b/src/libstd/bigint.rs index cdc65de4987..d7bd5fe6f20 100644 --- a/src/libstd/bigint.rs +++ b/src/libstd/bigint.rs @@ -458,10 +458,11 @@ pub impl BigUint { pure fn fill_concat(v: &[BigDigit], radix: uint, l: uint) -> ~str { if v.is_empty() { return ~"0" } - str::trim_left_chars(str::concat(vec::reversed(v).map(|n| { + let s = str::concat(vec::reversed(v).map(|n| { let s = uint::to_str_radix(*n as uint, radix); str::from_chars(vec::from_elem(l - s.len(), '0')) + s - })), ['0']) + })); + str::trim_left_chars_DBGBRWD(s, ['0']).to_owned() } } diff --git a/src/libstd/semver.rs b/src/libstd/semver.rs index 85996c8ac4a..a5534e29161 100644 --- a/src/libstd/semver.rs +++ b/src/libstd/semver.rs @@ -223,12 +223,12 @@ pub fn parse(s: &str) -> Option<Version> { if ! str::is_ascii(s) { return None; } - let s = s.trim(); + let s = s.trim_DBGBRWD(); let mut bad = false; do bad_parse::cond.trap(|_| { debug!("bad"); bad = true }).in { do io::with_str_reader(s) |rdr| { let v = parse_reader(rdr); - if bad || v.to_str() != s { + if bad || v.to_str() != s.to_owned() { None } else { Some(v) |
