diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-11-28 23:52:11 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-12-04 22:35:53 +1100 |
| commit | 9d64e46013096997627da62ecc65225bc22682e8 (patch) | |
| tree | fa20c8fd1d653acff5f996253d16103dd61addd9 /src/librustc/metadata/decoder.rs | |
| parent | 9635c763ba5edc8c8ea2868b895548b52f640e5a (diff) | |
| download | rust-9d64e46013096997627da62ecc65225bc22682e8.tar.gz rust-9d64e46013096997627da62ecc65225bc22682e8.zip | |
std::str: remove from_utf8.
This function had type &[u8] -> ~str, i.e. it allocates a string internally, even though the non-allocating version that take &[u8] -> &str and ~[u8] -> ~str are all that is necessary in most circumstances.
Diffstat (limited to 'src/librustc/metadata/decoder.rs')
| -rw-r--r-- | src/librustc/metadata/decoder.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index b5746cec58d..7ccfe6b8d21 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -1274,8 +1274,8 @@ fn family_names_type(fam: Family) -> bool { fn read_path(d: ebml::Doc) -> (~str, uint) { reader::with_doc_data(d, |desc| { let pos = u64_from_be_bytes(desc, 0u, 4u) as uint; - let pathbytes = desc.slice(4u, desc.len()); - let path = str::from_utf8(pathbytes); + let pathbytes = desc.slice_from(4u).to_owned(); + let path = str::from_utf8_owned(pathbytes); (path, pos) }) |
