Skip to content

Commit 96cd61a

Browse files
committed
std: convert {vec,str}::to_owned to methods.
1 parent e06579b commit 96cd61a

31 files changed

+95
-99
lines changed

src/libextra/flatpipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ pub mod flatteners {
450450
T: Decodable<D>>(
451451
buf: &[u8])
452452
-> T {
453-
let buf = vec::to_owned(buf);
453+
let buf = buf.to_owned();
454454
let buf_reader = @BufReader::new(buf);
455455
let reader = buf_reader as @Reader;
456456
let mut deser: D = FromReader::from_reader(reader);

src/libextra/getopts.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result {
345345
}
346346
i += 1;
347347
}
348-
return Ok(Matches {opts: vec::to_owned(opts),
348+
return Ok(Matches {opts: opts.to_owned(),
349349
vals: vals,
350350
free: free});
351351
}
@@ -447,7 +447,7 @@ pub fn opt_default(mm: &Matches, nm: &str, def: &str) -> Option<~str> {
447447
let vals = opt_vals(mm, nm);
448448
if vals.is_empty() { return None::<~str>; }
449449
return match vals[0] { Val(ref s) => Some::<~str>(copy *s),
450-
_ => Some::<~str>(str::to_owned(def)) }
450+
_ => Some::<~str>(def.to_owned()) }
451451
}
452452

453453
#[deriving(Eq)]
@@ -487,10 +487,10 @@ pub mod groups {
487487
desc: &str, hint: &str) -> OptGroup {
488488
let len = short_name.len();
489489
assert!(len == 1 || len == 0);
490-
return OptGroup { short_name: str::to_owned(short_name),
491-
long_name: str::to_owned(long_name),
492-
hint: str::to_owned(hint),
493-
desc: str::to_owned(desc),
490+
return OptGroup { short_name: short_name.to_owned(),
491+
long_name: long_name.to_owned(),
492+
hint: hint.to_owned(),
493+
desc: desc.to_owned(),
494494
hasarg: Yes,
495495
occur: Req};
496496
}
@@ -500,10 +500,10 @@ pub mod groups {
500500
desc: &str, hint: &str) -> OptGroup {
501501
let len = short_name.len();
502502
assert!(len == 1 || len == 0);
503-
return OptGroup {short_name: str::to_owned(short_name),
504-
long_name: str::to_owned(long_name),
505-
hint: str::to_owned(hint),
506-
desc: str::to_owned(desc),
503+
return OptGroup {short_name: short_name.to_owned(),
504+
long_name: long_name.to_owned(),
505+
hint: hint.to_owned(),
506+
desc: desc.to_owned(),
507507
hasarg: Yes,
508508
occur: Optional};
509509
}
@@ -513,10 +513,10 @@ pub mod groups {
513513
desc: &str) -> OptGroup {
514514
let len = short_name.len();
515515
assert!(len == 1 || len == 0);
516-
return OptGroup {short_name: str::to_owned(short_name),
517-
long_name: str::to_owned(long_name),
516+
return OptGroup {short_name: short_name.to_owned(),
517+
long_name: long_name.to_owned(),
518518
hint: ~"",
519-
desc: str::to_owned(desc),
519+
desc: desc.to_owned(),
520520
hasarg: No,
521521
occur: Optional};
522522
}
@@ -526,10 +526,10 @@ pub mod groups {
526526
desc: &str, hint: &str) -> OptGroup {
527527
let len = short_name.len();
528528
assert!(len == 1 || len == 0);
529-
return OptGroup {short_name: str::to_owned(short_name),
530-
long_name: str::to_owned(long_name),
531-
hint: str::to_owned(hint),
532-
desc: str::to_owned(desc),
529+
return OptGroup {short_name: short_name.to_owned(),
530+
long_name: long_name.to_owned(),
531+
hint: hint.to_owned(),
532+
desc: desc.to_owned(),
533533
hasarg: Maybe,
534534
occur: Optional};
535535
}
@@ -542,10 +542,10 @@ pub mod groups {
542542
desc: &str, hint: &str) -> OptGroup {
543543
let len = short_name.len();
544544
assert!(len == 1 || len == 0);
545-
return OptGroup {short_name: str::to_owned(short_name),
546-
long_name: str::to_owned(long_name),
547-
hint: str::to_owned(hint),
548-
desc: str::to_owned(desc),
545+
return OptGroup {short_name: short_name.to_owned(),
546+
long_name: long_name.to_owned(),
547+
hint: hint.to_owned(),
548+
desc: desc.to_owned(),
549549
hasarg: Yes,
550550
occur: Multi};
551551
}
@@ -654,7 +654,7 @@ pub mod groups {
654654
row
655655
});
656656

657-
return str::to_owned(brief) +
657+
return brief.to_owned() +
658658
"\n\nOptions:\n" +
659659
rows.connect("\n") +
660660
"\n\n";

src/libextra/md4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn md4(msg: &[u8]) -> Quad {
3030
let orig_len: u64 = (msg.len() * 8u) as u64;
3131

3232
// pad message
33-
let mut msg = vec::append(vec::to_owned(msg), [0x80u8]);
33+
let mut msg = vec::append(msg.to_owned(), [0x80u8]);
3434
let mut bitlen = orig_len + 8u64;
3535
while (bitlen + 64u64) % 512u64 > 0u64 {
3636
msg.push(0u8);

src/libextra/num/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ impl BigUint {
564564
/// Creates and initializes an BigUint.
565565
566566
pub fn from_slice(slice: &[BigDigit]) -> BigUint {
567-
return BigUint::new(vec::to_owned(slice));
567+
return BigUint::new(slice.to_owned());
568568
}
569569

570570
/// Creates and initializes an BigUint.

src/libextra/stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'self> Stats for &'self [f64] {
5757

5858
fn median(self) -> f64 {
5959
assert!(self.len() != 0);
60-
let mut tmp = vec::to_owned(self);
60+
let mut tmp = self.to_owned();
6161
sort::tim_sort(tmp);
6262
if tmp.len() & 1 == 0 {
6363
let m = tmp.len() / 2;

src/libextra/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ mod tests {
10291029
10301030
fn test(s: &str, format: &str) -> bool {
10311031
match strptime(s, format) {
1032-
Ok(ref tm) => tm.strftime(format) == str::to_owned(s),
1032+
Ok(ref tm) => tm.strftime(format) == s.to_owned(),
10331033
Err(e) => fail!(e)
10341034
}
10351035
}

src/libfuzzer/fuzzer.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ pub fn check_variants_T<T:Copy>(crate: @ast::crate,
328328
if L < 100 {
329329
do under(uint::min(L, 20)) |i| {
330330
error!("Replacing... #%?", uint::to_str(i));
331-
let fname = str::to_owned(filename.to_str());
331+
let fname = filename.to_str();
332332
do under(uint::min(L, 30)) |j| {
333333
let fname = fname.to_str();
334334
error!("With... %?", stringifier(things[j], intr));

src/librustc/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ pub fn default_configuration(sess: Session, argv0: @~str, input: &input) ->
9696
};
9797

9898
return ~[ // Target bindings.
99-
attr::mk_word_item(@str::to_owned(os::FAMILY)),
99+
attr::mk_word_item(@os::FAMILY.to_owned()),
100100
mk(@~"target_os", @tos),
101-
mk(@~"target_family", @str::to_owned(os::FAMILY)),
101+
mk(@~"target_family", @os::FAMILY.to_owned()),
102102
mk(@~"target_arch", @arch),
103103
mk(@~"target_endian", @end),
104104
mk(@~"target_word_size", @wordsz),

src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ pub fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt,
570570
let item_doc = lookup_item(id, cdata.data);
571571
let path = {
572572
let item_path = item_path(item_doc);
573-
vec::to_owned(item_path.init())
573+
item_path.init().to_owned()
574574
};
575575
match decode_inlined_item(cdata, tcx, copy path, item_doc) {
576576
Some(ref ii) => csearch::found((/*bad*/copy *ii)),

src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ pub fn encode_metadata(parms: EncodeParams, crate: &crate) -> ~[u8] {
15161516

15171517
let writer_bytes: &mut ~[u8] = wr.bytes;
15181518

1519-
vec::to_owned(metadata_encoding_version) +
1519+
metadata_encoding_version.to_owned() +
15201520
flate::deflate_bytes(*writer_bytes)
15211521
}
15221522

0 commit comments

Comments
 (0)