diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-11 11:49:51 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-12 12:21:03 +1000 |
| commit | 96cd61ad034cc9e88ab6a7845c3480dbc1ea62f3 (patch) | |
| tree | 02a109c7703430ff9595c631e3ba4621c0374f1c /src/libextra | |
| parent | e06579bc0935ed1dcbddef41bc1b6a8850a2059c (diff) | |
std: convert {vec,str}::to_owned to methods.
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/flatpipes.rs | 2 | ||||
| -rw-r--r-- | src/libextra/getopts.rs | 44 | ||||
| -rw-r--r-- | src/libextra/md4.rs | 2 | ||||
| -rw-r--r-- | src/libextra/num/bigint.rs | 2 | ||||
| -rw-r--r-- | src/libextra/stats.rs | 2 | ||||
| -rw-r--r-- | src/libextra/time.rs | 2 |
6 files changed, 27 insertions, 27 deletions
diff --git a/src/libextra/flatpipes.rs b/src/libextra/flatpipes.rs index c0f619c1b85..36ffbb731c8 100644 --- a/src/libextra/flatpipes.rs +++ b/src/libextra/flatpipes.rs @@ -450,7 +450,7 @@ pub mod flatteners { T: Decodable<D>>( buf: &[u8]) -> T { - let buf = vec::to_owned(buf); + let buf = buf.to_owned(); let buf_reader = @BufReader::new(buf); let reader = buf_reader as @Reader; let mut deser: D = FromReader::from_reader(reader); diff --git a/src/libextra/getopts.rs b/src/libextra/getopts.rs index 8d58bd18859..9fe9ad64010 100644 --- a/src/libextra/getopts.rs +++ b/src/libextra/getopts.rs @@ -345,7 +345,7 @@ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result { } i += 1; } - return Ok(Matches {opts: vec::to_owned(opts), + return Ok(Matches {opts: opts.to_owned(), vals: vals, free: free}); } @@ -447,7 +447,7 @@ pub fn opt_default(mm: &Matches, nm: &str, def: &str) -> Option<~str> { let vals = opt_vals(mm, nm); if vals.is_empty() { return None::<~str>; } return match vals[0] { Val(ref s) => Some::<~str>(copy *s), - _ => Some::<~str>(str::to_owned(def)) } + _ => Some::<~str>(def.to_owned()) } } #[deriving(Eq)] @@ -487,10 +487,10 @@ pub mod groups { desc: &str, hint: &str) -> OptGroup { let len = short_name.len(); assert!(len == 1 || len == 0); - return OptGroup { short_name: str::to_owned(short_name), - long_name: str::to_owned(long_name), - hint: str::to_owned(hint), - desc: str::to_owned(desc), + return OptGroup { short_name: short_name.to_owned(), + long_name: long_name.to_owned(), + hint: hint.to_owned(), + desc: desc.to_owned(), hasarg: Yes, occur: Req}; } @@ -500,10 +500,10 @@ pub mod groups { desc: &str, hint: &str) -> OptGroup { let len = short_name.len(); assert!(len == 1 || len == 0); - return OptGroup {short_name: str::to_owned(short_name), - long_name: str::to_owned(long_name), - hint: str::to_owned(hint), - desc: str::to_owned(desc), + return OptGroup {short_name: short_name.to_owned(), + long_name: long_name.to_owned(), + hint: hint.to_owned(), + desc: desc.to_owned(), hasarg: Yes, occur: Optional}; } @@ -513,10 +513,10 @@ pub mod groups { desc: &str) -> OptGroup { let len = short_name.len(); assert!(len == 1 || len == 0); - return OptGroup {short_name: str::to_owned(short_name), - long_name: str::to_owned(long_name), + return OptGroup {short_name: short_name.to_owned(), + long_name: long_name.to_owned(), hint: ~"", - desc: str::to_owned(desc), + desc: desc.to_owned(), hasarg: No, occur: Optional}; } @@ -526,10 +526,10 @@ pub mod groups { desc: &str, hint: &str) -> OptGroup { let len = short_name.len(); assert!(len == 1 || len == 0); - return OptGroup {short_name: str::to_owned(short_name), - long_name: str::to_owned(long_name), - hint: str::to_owned(hint), - desc: str::to_owned(desc), + return OptGroup {short_name: short_name.to_owned(), + long_name: long_name.to_owned(), + hint: hint.to_owned(), + desc: desc.to_owned(), hasarg: Maybe, occur: Optional}; } @@ -542,10 +542,10 @@ pub mod groups { desc: &str, hint: &str) -> OptGroup { let len = short_name.len(); assert!(len == 1 || len == 0); - return OptGroup {short_name: str::to_owned(short_name), - long_name: str::to_owned(long_name), - hint: str::to_owned(hint), - desc: str::to_owned(desc), + return OptGroup {short_name: short_name.to_owned(), + long_name: long_name.to_owned(), + hint: hint.to_owned(), + desc: desc.to_owned(), hasarg: Yes, occur: Multi}; } @@ -654,7 +654,7 @@ pub mod groups { row }); - return str::to_owned(brief) + + return brief.to_owned() + "\n\nOptions:\n" + rows.connect("\n") + "\n\n"; diff --git a/src/libextra/md4.rs b/src/libextra/md4.rs index f12c9d6573e..01edbbe366d 100644 --- a/src/libextra/md4.rs +++ b/src/libextra/md4.rs @@ -30,7 +30,7 @@ pub fn md4(msg: &[u8]) -> Quad { let orig_len: u64 = (msg.len() * 8u) as u64; // pad message - let mut msg = vec::append(vec::to_owned(msg), [0x80u8]); + let mut msg = vec::append(msg.to_owned(), [0x80u8]); let mut bitlen = orig_len + 8u64; while (bitlen + 64u64) % 512u64 > 0u64 { msg.push(0u8); diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs index c6e7592a314..bd6425d779c 100644 --- a/src/libextra/num/bigint.rs +++ b/src/libextra/num/bigint.rs @@ -564,7 +564,7 @@ impl BigUint { /// Creates and initializes an BigUint. pub fn from_slice(slice: &[BigDigit]) -> BigUint { - return BigUint::new(vec::to_owned(slice)); + return BigUint::new(slice.to_owned()); } /// Creates and initializes an BigUint. diff --git a/src/libextra/stats.rs b/src/libextra/stats.rs index 0cc1ee9a1d7..a9034074d93 100644 --- a/src/libextra/stats.rs +++ b/src/libextra/stats.rs @@ -57,7 +57,7 @@ impl<'self> Stats for &'self [f64] { fn median(self) -> f64 { assert!(self.len() != 0); - let mut tmp = vec::to_owned(self); + let mut tmp = self.to_owned(); sort::tim_sort(tmp); if tmp.len() & 1 == 0 { let m = tmp.len() / 2; diff --git a/src/libextra/time.rs b/src/libextra/time.rs index caaa2994405..8b754f8c560 100644 --- a/src/libextra/time.rs +++ b/src/libextra/time.rs @@ -1029,7 +1029,7 @@ mod tests { fn test(s: &str, format: &str) -> bool { match strptime(s, format) { - Ok(ref tm) => tm.strftime(format) == str::to_owned(s), + Ok(ref tm) => tm.strftime(format) == s.to_owned(), Err(e) => fail!(e) } } |
