Skip to content

Commit 1ec06e0

Browse files
alexcrichtonthestinger
authored andcommitted
Remove the global 'vec::to_owned' function
1 parent 2b96408 commit 1ec06e0

File tree

19 files changed

+31
-48
lines changed

19 files changed

+31
-48
lines changed

src/libextra/flatpipes.rs

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

src/libextra/getopts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result {
343343
}
344344
i += 1;
345345
}
346-
return Ok(Matches {opts: vec::to_owned(opts),
346+
return Ok(Matches {opts: opts.to_owned(),
347347
vals: vals,
348348
free: free});
349349
}

src/libextra/md4.rs

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

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

src/libextra/num/bigint.rs

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

573573
/// Creates and initializes an BigUint.

src/libextra/stats.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use sort;
1212
use std::cmp;
1313
use std::io;
1414
use std::num;
15-
use std::vec;
1615

1716
// NB: this can probably be rewritten in terms of num::Num
1817
// to be less f64-specific.
@@ -200,13 +199,13 @@ impl<'self> Stats for &'self [f64] {
200199
}
201200

202201
fn percentile(self, pct: f64) -> f64 {
203-
let mut tmp = vec::to_owned(self);
202+
let mut tmp = self.to_owned();
204203
sort::tim_sort(tmp);
205204
percentile_of_sorted(tmp, pct)
206205
}
207206

208207
fn quartiles(self) -> (f64,f64,f64) {
209-
let mut tmp = vec::to_owned(self);
208+
let mut tmp = self.to_owned();
210209
sort::tim_sort(tmp);
211210
let a = percentile_of_sorted(tmp, 25.0);
212211
let b = percentile_of_sorted(tmp, 50.0);
@@ -251,7 +250,7 @@ priv fn percentile_of_sorted(sorted_samples: &[f64],
251250
///
252251
/// See: http://en.wikipedia.org/wiki/Winsorising
253252
pub fn winsorize(samples: &mut [f64], pct: f64) {
254-
let mut tmp = vec::to_owned(samples);
253+
let mut tmp = samples.to_owned();
255254
sort::tim_sort(tmp);
256255
let lo = percentile_of_sorted(tmp, pct);
257256
let hi = percentile_of_sorted(tmp, 100.0-pct);

src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ pub fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt,
714714
let item_doc = lookup_item(id, cdata.data);
715715
let path = {
716716
let item_path = item_path(item_doc);
717-
vec::to_owned(item_path.init())
717+
item_path.init().to_owned()
718718
};
719719
match decode_inlined_item(cdata, tcx, copy path, item_doc) {
720720
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
@@ -1659,7 +1659,7 @@ pub fn encode_metadata(parms: EncodeParams, crate: &crate) -> ~[u8] {
16591659

16601660
let writer_bytes: &mut ~[u8] = wr.bytes;
16611661

1662-
vec::to_owned(metadata_encoding_version) +
1662+
metadata_encoding_version.to_owned() +
16631663
flate::deflate_bytes(*writer_bytes)
16641664
}
16651665

src/librustc/middle/check_match.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ pub fn specialize(cx: &MatchCheckCtxt,
484484
match cx.tcx.def_map.find(&pat_id) {
485485
Some(&def_variant(_, id)) => {
486486
if variant(id) == *ctor_id {
487-
Some(vec::to_owned(r.tail()))
487+
Some(r.tail().to_owned())
488488
} else {
489489
None
490490
}
@@ -522,7 +522,7 @@ pub fn specialize(cx: &MatchCheckCtxt,
522522
_ => fail!("type error")
523523
};
524524
if match_ {
525-
Some(vec::to_owned(r.tail()))
525+
Some(r.tail().to_owned())
526526
} else {
527527
None
528528
}
@@ -569,7 +569,7 @@ pub fn specialize(cx: &MatchCheckCtxt,
569569
_ => fail!("type error")
570570
};
571571
if match_ {
572-
Some(vec::to_owned(r.tail()))
572+
Some(r.tail().to_owned())
573573
} else {
574574
None
575575
}
@@ -579,7 +579,7 @@ pub fn specialize(cx: &MatchCheckCtxt,
579579
Some(args) => args,
580580
None => vec::from_elem(arity, wild())
581581
};
582-
Some(vec::append(args, vec::to_owned(r.tail())))
582+
Some(vec::append(args, r.tail()))
583583
}
584584
def_variant(_, _) => None,
585585

@@ -591,7 +591,7 @@ pub fn specialize(cx: &MatchCheckCtxt,
591591
Some(args) => new_args = args,
592592
None => new_args = vec::from_elem(arity, wild())
593593
}
594-
Some(vec::append(new_args, vec::to_owned(r.tail())))
594+
Some(vec::append(new_args, r.tail()))
595595
}
596596
_ => None
597597
}
@@ -609,7 +609,7 @@ pub fn specialize(cx: &MatchCheckCtxt,
609609
_ => wild()
610610
}
611611
});
612-
Some(vec::append(args, vec::to_owned(r.tail())))
612+
Some(vec::append(args, r.tail()))
613613
} else {
614614
None
615615
}
@@ -640,7 +640,7 @@ pub fn specialize(cx: &MatchCheckCtxt,
640640
_ => wild()
641641
}
642642
}).collect();
643-
Some(vec::append(args, vec::to_owned(r.tail())))
643+
Some(vec::append(args, r.tail()))
644644
}
645645
}
646646
}
@@ -676,14 +676,14 @@ pub fn specialize(cx: &MatchCheckCtxt,
676676
single => true,
677677
_ => fail!("type error")
678678
};
679-
if match_ { Some(vec::to_owned(r.tail())) } else { None }
679+
if match_ { Some(r.tail().to_owned()) } else { None }
680680
}
681681
pat_range(lo, hi) => {
682682
let (c_lo, c_hi) = match *ctor_id {
683683
val(ref v) => ((/*bad*/copy *v), (/*bad*/copy *v)),
684684
range(ref lo, ref hi) =>
685685
((/*bad*/copy *lo), (/*bad*/copy *hi)),
686-
single => return Some(vec::to_owned(r.tail())),
686+
single => return Some(r.tail().to_owned()),
687687
_ => fail!("type error")
688688
};
689689
let v_lo = eval_const_expr(cx.tcx, lo);
@@ -693,7 +693,7 @@ pub fn specialize(cx: &MatchCheckCtxt,
693693
let m2 = compare_const_vals(&c_hi, &v_hi);
694694
match (m1, m2) {
695695
(Some(val1), Some(val2)) if val1 >= 0 && val2 <= 0 => {
696-
Some(vec::to_owned(r.tail()))
696+
Some(r.tail().to_owned())
697697
},
698698
(Some(_), Some(_)) => None,
699699
_ => {
@@ -734,7 +734,7 @@ pub fn specialize(cx: &MatchCheckCtxt,
734734
}
735735

736736
pub fn default(cx: &MatchCheckCtxt, r: &[@pat]) -> Option<~[@pat]> {
737-
if is_wild(cx, r[0]) { Some(vec::to_owned(r.tail())) }
737+
if is_wild(cx, r[0]) { Some(r.tail().to_owned()) }
738738
else { None }
739739
}
740740

src/librustc/middle/trans/adt.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
use std::container::Map;
4848
use std::libc::c_ulonglong;
4949
use std::option::{Option, Some, None};
50-
use std::vec;
5150

5251
use lib::llvm::{ValueRef, True, IntEQ, IntNE};
5352
use middle::trans::_match;
@@ -219,7 +218,7 @@ fn mk_struct(cx: &mut CrateContext, tys: &[ty::t], packed: bool) -> Struct {
219218
size: machine::llsize_of_alloc(cx, llty_rec) /*bad*/as u64,
220219
align: machine::llalign_of_min(cx, llty_rec) /*bad*/as u64,
221220
packed: packed,
222-
fields: vec::to_owned(tys)
221+
fields: tys.to_owned(),
223222
}
224223
}
225224

src/librustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3782,7 +3782,7 @@ pub fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path {
37823782
}
37833783

37843784
ast_map::node_variant(ref variant, _, path) => {
3785-
vec::append_one(vec::to_owned(path.init()),
3785+
vec::append_one(path.init().to_owned(),
37863786
ast_map::path_name((*variant).node.name))
37873787
}
37883788

0 commit comments

Comments
 (0)