Skip to content

Commit 9115685

Browse files
author
Nick Desaulniers
committed
more merge conflicts
2 parents 5005ed3 + df483e8 commit 9115685

File tree

148 files changed

+2154
-2263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+2154
-2263
lines changed

doc/tutorial.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ let new_favorite_crayon_name = favorite_crayon_name.trim();
14101410
14111411
if favorite_crayon_name.len() > 5 {
14121412
// Create a substring
1413-
println(favorite_crayon_name.substr(0, 5));
1413+
println(favorite_crayon_name.slice_chars(0, 5));
14141414
}
14151415
~~~
14161416

src/compiletest/procsrv.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
use core::prelude::*;
12+
use core::iterator::IteratorUtil;
1213

1314
use core::os;
1415
use core::run;
@@ -58,7 +59,7 @@ pub fn run(lib_path: &str,
5859
err_fd: None
5960
});
6061

61-
for input.each |input| {
62+
for input.iter().advance |input| {
6263
proc.input().write_str(*input);
6364
}
6465
let output = proc.finish_with_output();

src/compiletest/runtest.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
171171
if props.pp_exact.is_some() {
172172
// Now we have to care about line endings
173173
let cr = ~"\r";
174-
actual = str::replace(actual, cr, "");
175-
expected = str::replace(expected, cr, "");
174+
actual = actual.replace(cr, "");
175+
expected = expected.replace(cr, "");
176176
}
177177

178178
compare_source(expected, actual);
@@ -238,7 +238,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
238238
// do not optimize debuginfo tests
239239
let mut config = match config.rustcflags {
240240
Some(ref flags) => config {
241-
rustcflags: Some(str::replace(*flags, "-O", "")),
241+
rustcflags: Some(flags.replace("-O", "")),
242242
.. copy *config
243243
},
244244
None => copy *config
@@ -254,7 +254,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
254254
}
255255
256256
// write debugger script
257-
let script_str = str::append(cmds, "\nquit\n");
257+
let script_str = cmds.append("\nquit\n");
258258
debug!("script_str = %s", script_str);
259259
dump_output_file(config, testfile, script_str, "debugger.script");
260260

src/libextra/base64.rs

+9-10
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
1313
use core::prelude::*;
1414

15-
use core::str;
1615
use core::vec;
1716

1817
/// A trait for converting a value to base64 encoding.
@@ -111,7 +110,7 @@ impl<'self> ToBase64 for &'self str {
111110
*
112111
*/
113112
fn to_base64(&self) -> ~str {
114-
str::to_bytes(*self).to_base64()
113+
self.as_bytes().to_base64()
115114
}
116115
}
117116

@@ -224,7 +223,7 @@ impl<'self> FromBase64 for &'self str {
224223
* ~~~
225224
*/
226225
fn from_base64(&self) -> ~[u8] {
227-
str::to_bytes(*self).from_base64()
226+
self.as_bytes().from_base64()
228227
}
229228
}
230229

@@ -245,12 +244,12 @@ mod tests {
245244

246245
#[test]
247246
fn test_from_base64() {
248-
assert_eq!("".from_base64(), str::to_bytes(""));
249-
assert_eq!("Zg==".from_base64(), str::to_bytes("f"));
250-
assert_eq!("Zm8=".from_base64(), str::to_bytes("fo"));
251-
assert_eq!("Zm9v".from_base64(), str::to_bytes("foo"));
252-
assert_eq!("Zm9vYg==".from_base64(), str::to_bytes("foob"));
253-
assert_eq!("Zm9vYmE=".from_base64(), str::to_bytes("fooba"))
254-
assert_eq!("Zm9vYmFy".from_base64(), str::to_bytes("foobar"));
247+
assert_eq!("".from_base64(), "".as_bytes().to_owned());
248+
assert_eq!("Zg==".from_base64(), "f".as_bytes().to_owned());
249+
assert_eq!("Zm8=".from_base64(), "fo".as_bytes().to_owned());
250+
assert_eq!("Zm9v".from_base64(), "foo".as_bytes().to_owned());
251+
assert_eq!("Zm9vYg==".from_base64(), "foob".as_bytes().to_owned());
252+
assert_eq!("Zm9vYmE=".from_base64(), "fooba".as_bytes().to_owned());
253+
assert_eq!("Zm9vYmFy".from_base64(), "foobar".as_bytes().to_owned());
255254
}
256255
}

src/libextra/ebml.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,6 @@ pub mod writer {
607607

608608
use core::cast;
609609
use core::io;
610-
use core::str;
611610

612611
// ebml writing
613612
pub struct Encoder {
@@ -725,7 +724,7 @@ pub mod writer {
725724
}
726725

727726
pub fn wr_tagged_str(&mut self, tag_id: uint, v: &str) {
728-
str::byte_slice(v, |b| self.wr_tagged_bytes(tag_id, b));
727+
self.wr_tagged_bytes(tag_id, v.as_bytes());
729728
}
730729

731730
pub fn wr_bytes(&mut self, b: &[u8]) {
@@ -735,7 +734,7 @@ pub mod writer {
735734

736735
pub fn wr_str(&mut self, s: &str) {
737736
debug!("Write str: %?", s);
738-
self.writer.write(str::to_bytes(s));
737+
self.writer.write(s.as_bytes());
739738
}
740739
}
741740

src/libextra/fileinput.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ mod test {
487487
let mut buf : ~[u8] = vec::from_elem(6, 0u8);
488488
let count = fi.read(buf, 10);
489489
assert_eq!(count, 6);
490-
assert_eq!(buf, "0\n1\n2\n".to_bytes());
490+
assert_eq!(buf, "0\n1\n2\n".as_bytes().to_owned());
491491
assert!(fi.eof())
492492
assert_eq!(fi.state().line_num, 3);
493493
}

src/libextra/flatpipes.rs

+1-1
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

+25-25
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
}
@@ -593,7 +593,7 @@ pub mod groups {
593593
*/
594594
pub fn usage(brief: &str, opts: &[OptGroup]) -> ~str {
595595

596-
let desc_sep = ~"\n" + str::repeat(" ", 24);
596+
let desc_sep = ~"\n" + " ".repeat(24);
597597

598598
let rows = vec::map(opts, |optref| {
599599
let OptGroup{short_name: short_name,
@@ -603,7 +603,7 @@ pub mod groups {
603603
hasarg: hasarg,
604604
_} = copy *optref;
605605

606-
let mut row = str::repeat(" ", 4);
606+
let mut row = " ".repeat(4);
607607

608608
// short option
609609
row += match short_name.len() {
@@ -629,7 +629,7 @@ pub mod groups {
629629
// here we just need to indent the start of the description
630630
let rowlen = row.len();
631631
row += if rowlen < 24 {
632-
str::repeat(" ", 24 - rowlen)
632+
" ".repeat(24 - rowlen)
633633
} else {
634634
copy desc_sep
635635
};
@@ -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

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use core::prelude::*;
1212

13-
use core::str;
1413
use core::uint;
1514
use core::vec;
1615

@@ -30,7 +29,7 @@ pub fn md4(msg: &[u8]) -> Quad {
3029
let orig_len: u64 = (msg.len() * 8u) as u64;
3130

3231
// pad message
33-
let mut msg = vec::append(vec::to_owned(msg), [0x80u8]);
32+
let mut msg = vec::append(msg.to_owned(), [0x80u8]);
3433
let mut bitlen = orig_len + 8u64;
3534
while (bitlen + 64u64) % 512u64 > 0u64 {
3635
msg.push(0u8);
@@ -129,7 +128,7 @@ pub fn md4_str(msg: &[u8]) -> ~str {
129128

130129
/// Calculates the md4 hash of a string, returning the hex-encoded version of
131130
/// the hash
132-
pub fn md4_text(msg: &str) -> ~str { md4_str(str::to_bytes(msg)) }
131+
pub fn md4_text(msg: &str) -> ~str { md4_str(msg.as_bytes()) }
133132

134133
#[test]
135134
fn test_md4() {

src/libextra/net_tcp.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ mod test {
16361636
assert_eq!(net::ip::get_port(&sock.get_peer_addr()), 8887);
16371637
16381638
// Fulfill the protocol the test server expects
1639-
let resp_bytes = str::to_bytes("ping");
1639+
let resp_bytes = "ping".as_bytes().to_owned();
16401640
tcp_write_single(&sock, resp_bytes);
16411641
debug!("message sent");
16421642
sock.read(0u);
@@ -1756,9 +1756,7 @@ mod test {
17561756
buf_write(sock_buf, expected_req);
17571757
17581758
// so contrived!
1759-
let actual_resp = do str::as_bytes(&expected_resp.to_str()) |resp_buf| {
1760-
buf_read(sock_buf, resp_buf.len())
1761-
};
1759+
let actual_resp = buf_read(sock_buf, expected_resp.as_bytes().len());
17621760
17631761
let actual_req = server_result_po.recv();
17641762
debug!("REQ: expected: '%s' actual: '%s'",
@@ -1810,11 +1808,10 @@ mod test {
18101808

18111809
fn buf_write<W:io::Writer>(w: &W, val: &str) {
18121810
debug!("BUF_WRITE: val len %?", val.len());
1813-
do str::byte_slice(val) |b_slice| {
1814-
debug!("BUF_WRITE: b_slice len %?",
1815-
b_slice.len());
1816-
w.write(b_slice)
1817-
}
1811+
let b_slice = val.as_bytes();
1812+
debug!("BUF_WRITE: b_slice len %?",
1813+
b_slice.len());
1814+
w.write(b_slice)
18181815
}
18191816

18201817
fn buf_read<R:io::Reader>(r: &R, len: uint) -> ~str {
@@ -1877,7 +1874,8 @@ mod test {
18771874
server_ch.send(
18781875
str::from_bytes(data));
18791876
debug!("SERVER: before write");
1880-
tcp_write_single(&sock, str::to_bytes(resp_cell2.take()));
1877+
let s = resp_cell2.take();
1878+
tcp_write_single(&sock, s.as_bytes().to_owned());
18811879
debug!("SERVER: after write.. die");
18821880
kill_ch.send(None);
18831881
}
@@ -1949,7 +1947,7 @@ mod test {
19491947
}
19501948
else {
19511949
let sock = result::unwrap(connect_result);
1952-
let resp_bytes = str::to_bytes(resp);
1950+
let resp_bytes = resp.as_bytes().to_owned();
19531951
tcp_write_single(&sock, resp_bytes);
19541952
let read_result = sock.read(0u);
19551953
if read_result.is_err() {

src/libextra/net_url.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ mod tests {
10601060
/*
10611061
assert_eq!(decode_form_urlencoded([]).len(), 0);
10621062
1063-
let s = str::to_bytes("a=1&foo+bar=abc&foo+bar=12+%3D+34");
1063+
let s = "a=1&foo+bar=abc&foo+bar=12+%3D+34".as_bytes();
10641064
let form = decode_form_urlencoded(s);
10651065
assert_eq!(form.len(), 2);
10661066
assert_eq!(form.get_ref(&~"a"), &~[~"1"]);

src/libextra/num/bigint.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ impl ToStrRadix for BigUint {
524524
let s = uint::to_str_radix(*n as uint, radix);
525525
str::from_chars(vec::from_elem(l - s.len(), '0')) + s
526526
}).concat();
527-
s.trim_left_chars(['0']).to_owned()
527+
s.trim_left_chars(&'0').to_owned()
528528
}
529529
}
530530
}
@@ -534,7 +534,7 @@ impl FromStrRadix for BigUint {
534534
535535
pub fn from_str_radix(s: &str, radix: uint)
536536
-> Option<BigUint> {
537-
BigUint::parse_bytes(str::to_bytes(s), radix)
537+
BigUint::parse_bytes(s.as_bytes(), radix)
538538
}
539539
}
540540

@@ -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.
@@ -1090,7 +1090,7 @@ impl FromStrRadix for BigInt {
10901090
10911091
fn from_str_radix(s: &str, radix: uint)
10921092
-> Option<BigInt> {
1093-
BigInt::parse_bytes(str::to_bytes(s), radix)
1093+
BigInt::parse_bytes(s.as_bytes(), radix)
10941094
}
10951095
}
10961096

0 commit comments

Comments
 (0)