diff --git a/base64/base64.rs b/base64/base64.rs index fe20cfeb1..36e9ec796 100644 --- a/base64/base64.rs +++ b/base64/base64.rs @@ -92,9 +92,9 @@ pub fn uumain(args: Vec) -> int { } fn decode(input: &mut Reader, ignore_garbage: bool) { - let mut to_decode = match input.read_to_str() { + let mut to_decode = match input.read_to_string() { Ok(m) => m, - Err(f) => fail!(f.to_str()) + Err(f) => fail!(f.to_string()) }; to_decode = str::replace(to_decode.as_slice(), "\n", ""); @@ -112,15 +112,15 @@ fn decode(input: &mut Reader, ignore_garbage: bool) { match out.write(bytes.as_slice()) { Ok(_) => {} - Err(f) => { crash!(1, "{}", f.to_str()); } + Err(f) => { crash!(1, "{}", f.to_string()); } } match out.flush() { Ok(_) => {} - Err(f) => { crash!(1, "{}", f.to_str()); } + Err(f) => { crash!(1, "{}", f.to_string()); } } } Err(s) => { - error!("error: {}", s.to_str()); + error!("error: {}", s.to_string()); fail!() } } @@ -137,7 +137,7 @@ fn encode(input: &mut Reader, line_wrap: uint) { }; let to_encode = match input.read_to_end() { Ok(m) => m, - Err(f) => fail!(f.to_str()) + Err(f) => fail!(f.to_string()) }; let encoded = to_encode.as_slice().to_base64(b64_conf); diff --git a/cat/cat.rs b/cat/cat.rs index 01395bf55..26a81c6f4 100644 --- a/cat/cat.rs +++ b/cat/cat.rs @@ -284,7 +284,7 @@ fn open(path: &str) -> Option<(Box, bool)> { match File::open(&std::path::Path::new(path)) { Ok(f) => Some((box f as Box, false)), Err(e) => { - (writeln!(stderr(), "cat: {0:s}: {1:s}", path, e.to_str())).unwrap(); + (writeln!(stderr(), "cat: {0:s}: {1:s}", path, e.to_string())).unwrap(); None }, } diff --git a/common/util.rs b/common/util.rs index ffd10be80..90deafb80 100644 --- a/common/util.rs +++ b/common/util.rs @@ -59,7 +59,7 @@ macro_rules! crash_if_err( ($exitcode:expr, $exp:expr) => ( match $exp { Ok(m) => m, - Err(f) => crash!($exitcode, "{}", f.to_str()) + Err(f) => crash!($exitcode, "{}", f.to_string()) } ) ) @@ -69,7 +69,7 @@ macro_rules! safe_write( ($fd:expr, $($args:expr),+) => ( match write!($fd, $($args),+) { Ok(_) => {} - Err(f) => { fail!(f.to_str()); } + Err(f) => { fail!(f.to_string()); } } ) ) @@ -79,7 +79,7 @@ macro_rules! safe_writeln( ($fd:expr, $($args:expr),+) => ( match writeln!($fd, $($args),+) { Ok(_) => {} - Err(f) => { fail!(f.to_str()); } + Err(f) => { fail!(f.to_string()); } } ) ) @@ -89,7 +89,7 @@ macro_rules! safe_unwrap( ($exp:expr) => ( match $exp { Ok(m) => m, - Err(f) => crash!(1, "{}", f.to_str()) + Err(f) => crash!(1, "{}", f.to_string()) } ) ) diff --git a/cp/cp.rs b/cp/cp.rs index 52912feac..43848adc6 100644 --- a/cp/cp.rs +++ b/cp/cp.rs @@ -102,15 +102,15 @@ fn copy(matches: getopts::Matches) { Err(e) => if e.kind == io::FileNotFound { false } else { - error!("error: {:s}", e.to_str()); + error!("error: {:s}", e.to_string()); fail!() } }; if same_file { error!("error: \"{:s}\" and \"{:s}\" are the same file", - source.display().to_str(), - dest.display().to_str()); + source.display().to_string(), + dest.display().to_string()); fail!(); } @@ -118,7 +118,7 @@ fn copy(matches: getopts::Matches) { if io_result.is_err() { let err = io_result.unwrap_err(); - error!("error: {:s}", err.to_str()); + error!("error: {:s}", err.to_string()); fail!(); } } else { @@ -129,7 +129,7 @@ fn copy(matches: getopts::Matches) { for source in sources.iter() { if fs::stat(source).unwrap().kind != io::TypeFile { - error!("error: \"{:s}\" is not a file", source.display().to_str()); + error!("error: \"{:s}\" is not a file", source.display().to_string()); continue; } @@ -137,13 +137,13 @@ fn copy(matches: getopts::Matches) { full_dest.push(source.filename_str().unwrap()); - println!("{:s}", full_dest.display().to_str()); + println!("{:s}", full_dest.display().to_string()); let io_result = fs::copy(source, &full_dest); if io_result.is_err() { let err = io_result.unwrap_err(); - error!("error: {:s}", err.to_str()); + error!("error: {:s}", err.to_string()); fail!() } } diff --git a/cut/cut.rs b/cut/cut.rs index 1addd7a04..d53e30f00 100644 --- a/cut/cut.rs +++ b/cut/cut.rs @@ -56,7 +56,7 @@ fn cut_bytes(mut reader: BufferedReader, let mut out = BufferedWriter::new(std::io::stdio::stdout_raw()); let (use_delim, out_delim) = match opts.out_delim.clone() { Some(delim) => (true, delim), - None => (false, "".to_str()) + None => (false, "".to_string()) }; 'newline: loop { @@ -106,7 +106,7 @@ fn cut_characters(mut reader: BufferedReader, let mut out = BufferedWriter::new(std::io::stdio::stdout_raw()); let (use_delim, out_delim) = match opts.out_delim.clone() { Some(delim) => (true, delim), - None => (false, "".to_str()) + None => (false, "".to_string()) }; 'newline: loop { @@ -363,7 +363,7 @@ fn cut_files(mut filenames: Vec, mode: Mode) -> int { let mut stdin_read = false; let mut exit_code = 0; - if filenames.len() == 0 { filenames.push("-".to_str()); } + if filenames.len() == 0 { filenames.push("-".to_string()); } for filename in filenames.iter() { if filename.as_slice() == "-" { @@ -486,7 +486,7 @@ pub fn uumain(args: Vec) -> int { match matches.opt_str("delimiter") { Some(delim) => { if delim.as_slice().char_len() != 1 { - Err("the delimiter must be a single character".to_str()) + Err("the delimiter must be a single character".to_string()) } else { Ok(Fields(ranges, FieldOptions { @@ -498,7 +498,7 @@ pub fn uumain(args: Vec) -> int { } None => Ok(Fields(ranges, FieldOptions { - delimiter: "\t".to_str(), + delimiter: "\t".to_string(), out_delimeter: out_delim, only_delimited: only_delimited })) @@ -507,9 +507,9 @@ pub fn uumain(args: Vec) -> int { ) } (ref b, ref c, ref f) if b.is_some() || c.is_some() || f.is_some() => { - Err("only one type of list may be specified".to_str()) + Err("only one type of list may be specified".to_string()) } - _ => Err("you must specify a list of bytes, characters, or fields".to_str()) + _ => Err("you must specify a list of bytes, characters, or fields".to_string()) }; match mode_parse { diff --git a/kill/kill.rs b/kill/kill.rs index 663d07718..ee575c3fa 100644 --- a/kill/kill.rs +++ b/kill/kill.rs @@ -125,7 +125,7 @@ fn print_signal(signal_name_or_value: &str) { if signal.name == signal_name_or_value || (format!("SIG{}", signal.name).as_slice()) == signal_name_or_value { println!("{}", signal.value) exit!(EXIT_OK as i32) - } else if signal_name_or_value == signal.value.to_str().as_slice() { + } else if signal_name_or_value == signal.value.to_string().as_slice() { println!("{}", signal.name); exit!(EXIT_OK as i32) } @@ -169,7 +169,7 @@ fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { } for signal in ALL_SIGNALS.iter() { let long_name = format!("SIG{}", signal.name); - if signal.name == signal_name_or_value || (signal_name_or_value == signal.value.to_str().as_slice()) || (long_name.as_slice() == signal_name_or_value) { + if signal.name == signal_name_or_value || (signal_name_or_value == signal.value.to_string().as_slice()) || (long_name.as_slice() == signal_name_or_value) { return Some(signal.value); } } diff --git a/mkdir/mkdir.rs b/mkdir/mkdir.rs index 0ec032538..a0c1966de 100644 --- a/mkdir/mkdir.rs +++ b/mkdir/mkdir.rs @@ -157,7 +157,7 @@ fn mkdir(path: &Path, mode: FilePermission) { match fs::mkdir(path, mode) { Ok(_) => {}, Err(e) => { - crash!(1, "test {}", e.to_str()); + crash!(1, "test {}", e.to_string()); } } } diff --git a/mkuutils.rs b/mkuutils.rs index 67b7ca15c..78b35303b 100644 --- a/mkuutils.rs +++ b/mkuutils.rs @@ -39,7 +39,7 @@ fn main() { // XXX: this all just assumes that the IO works correctly let mut out = File::open_mode(&Path::new(outfile), Truncate, Write).unwrap(); let mut input = File::open(&Path::new("uutils/uutils.rs")).unwrap(); - let main = input.read_to_str().unwrap().replace("@CRATES@", crates.as_slice()).replace("@UTIL_MAP@", util_map.as_slice()); + let main = input.read_to_string().unwrap().replace("@CRATES@", crates.as_slice()).replace("@UTIL_MAP@", util_map.as_slice()); match out.write(main.as_bytes()) { Err(e) => fail!("{}", e), diff --git a/nl/nl.rs b/nl/nl.rs index 3c72e8bba..8e45bdae6 100644 --- a/nl/nl.rs +++ b/nl/nl.rs @@ -158,9 +158,9 @@ pub fn uumain(args: Vec) -> int { // nl implements the main functionality for an individual buffer. fn nl (reader: &mut BufferedReader, settings: &Settings) { let mut line_no = settings.starting_line_number; - // The current line number's width as a string. Using to_str is inefficient + // The current line number's width as a string. Using to_string is inefficient // but since we only do it once, it should not hurt. - let mut line_no_width = line_no.to_str().len(); + let mut line_no_width = line_no.to_string().len(); let line_no_width_initial = line_no_width; // Stores the smallest integer with one more digit than line_no, so that // when line_no >= line_no_threshold, we need to use one more digit. diff --git a/paste/paste.rs b/paste/paste.rs index fa3b6b353..0ee655a6e 100644 --- a/paste/paste.rs +++ b/paste/paste.rs @@ -66,7 +66,7 @@ fn paste(filenames: Vec, serial: bool, delimiters: &str) { } ) ).collect(); - let delimiters: Vec = delimiters.chars().map(|x| x.to_str()).collect(); + let delimiters: Vec = delimiters.chars().map(|x| x.to_string()).collect(); let mut delim_count = 0; if serial { for file in files.mut_iter() { @@ -80,7 +80,7 @@ fn paste(filenames: Vec, serial: bool, delimiters: &str) { Err(f) => if f.kind == io::EndOfFile { break } else { - crash!(1, "{}", f.to_str()) + crash!(1, "{}", f.to_string()) } } delim_count += 1; @@ -102,7 +102,7 @@ fn paste(filenames: Vec, serial: bool, delimiters: &str) { *eof.get_mut(i) = true; eof_count += 1; } else { - crash!(1, "{}", f.to_str()); + crash!(1, "{}", f.to_string()); } } } diff --git a/rm/rm.rs b/rm/rm.rs index 203cfc870..396bbb18d 100644 --- a/rm/rm.rs +++ b/rm/rm.rs @@ -136,7 +136,7 @@ fn remove(files: Vec, force: bool, interactive: InteractiveMode, one_fs: let walk_dir = match fs::walk_dir(&file) { Ok(m) => m, Err(f) => { - crash!(1, "{}", f.to_str()); + crash!(1, "{}", f.to_string()); } }; r = remove(walk_dir.map(|x| x.as_str().unwrap().to_string()).collect(), force, interactive, one_fs, preserve_root, recursive, dir, verbose).and(r); @@ -177,7 +177,7 @@ fn remove_dir(path: &Path, name: &str, interactive: InteractiveMode, verbose: bo match fs::rmdir(path) { Ok(_) => if verbose { println!("Removed '{}'", name); }, Err(f) => { - show_error!("{}", f.to_str()); + show_error!("{}", f.to_string()); return Err(1); } } @@ -197,7 +197,7 @@ fn remove_file(path: &Path, name: &str, interactive: InteractiveMode, verbose: b match fs::unlink(path) { Ok(_) => if verbose { println!("Removed '{}'", name); }, Err(f) => { - show_error!("{}", f.to_str()); + show_error!("{}", f.to_string()); return Err(1); } } diff --git a/rmdir/rmdir.rs b/rmdir/rmdir.rs index 5976ff66d..2f48c3472 100644 --- a/rmdir/rmdir.rs +++ b/rmdir/rmdir.rs @@ -90,7 +90,7 @@ fn remove_dir(path: &Path, dir: &str, ignore: bool, parents: bool, verbose: bool let mut walk_dir = match fs::walk_dir(path) { Ok(m) => m, Err(f) => { - show_error!("{}", f.to_str()); + show_error!("{}", f.to_string()); return Err(1); } }; @@ -111,7 +111,7 @@ fn remove_dir(path: &Path, dir: &str, ignore: bool, parents: bool, verbose: bool } } Err(f) => { - show_error!("{}", f.to_str()); + show_error!("{}", f.to_string()); r = Err(1); } } diff --git a/seq/seq.rs b/seq/seq.rs index 34ea1efd6..da33e9c2c 100644 --- a/seq/seq.rs +++ b/seq/seq.rs @@ -24,7 +24,7 @@ macro_rules! pipe_write( if f.kind == io::BrokenPipe { return } else { - fail!("{}", f.to_str()) + fail!("{}", f.to_string()) } } ) @@ -232,7 +232,7 @@ fn print_seq(first: f64, step: f64, last: f64, largest_dec: uint, separator: Str let mut i = 0i; let mut value = first + i as f64 * step; while !done_printing(value, step, last) { - let istr = value.to_str(); + let istr = value.to_string(); let ilen = istr.len(); let before_dec = istr.as_slice().find('.').unwrap_or(ilen); if pad && before_dec < padding { diff --git a/tac/tac.rs b/tac/tac.rs index 001bf1fea..670704e73 100644 --- a/tac/tac.rs +++ b/tac/tac.rs @@ -78,7 +78,7 @@ fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { box crash_if_err!(1, io::File::open(&Path::new(filename))) as Box } ); - let mut data = crash_if_err!(1, file.read_to_str()); + let mut data = crash_if_err!(1, file.read_to_string()); if data.as_slice().ends_with("\n") { // removes blank line that is inserted otherwise let mut buf = data.into_string(); diff --git a/tee/tee.rs b/tee/tee.rs index b63eb868b..77ebbc598 100644 --- a/tee/tee.rs +++ b/tee/tee.rs @@ -144,7 +144,7 @@ impl Reader for NamedReader { fn with_path(path: &Path, cb: || -> IoResult) -> IoResult { match cb() { - Err(f) => { warn(format!("{}: {}", path.display(), f.to_str()).as_slice()); Err(f) } + Err(f) => { warn(format!("{}: {}", path.display(), f.to_string()).as_slice()); Err(f) } okay => okay } } diff --git a/truncate/truncate.rs b/truncate/truncate.rs index 1698b616f..141a97cbe 100644 --- a/truncate/truncate.rs +++ b/truncate/truncate.rs @@ -105,13 +105,13 @@ fn truncate(no_create: bool, _: bool, reference: Option, size: Option m, Err(f) => { - crash!(1, "{}", f.to_str()) + crash!(1, "{}", f.to_string()) } }; match fs::stat(rfile.path()) { Ok(stat) => (stat.size, Reference), Err(f) => { - show_error!("{}", f.to_str()); + show_error!("{}", f.to_string()); return Err(1); } } @@ -127,7 +127,7 @@ fn truncate(no_create: bool, _: bool, reference: Option, size: Option stat.size, Err(f) => { - show_warning!("{}", f.to_str()); + show_warning!("{}", f.to_string()); continue; } }; @@ -143,13 +143,13 @@ fn truncate(no_create: bool, _: bool, reference: Option, size: Option {} Err(f) => { - show_error!("{}", f.to_str()); + show_error!("{}", f.to_string()); return Err(1); } } } Err(f) => { - show_error!("{}", f.to_str()); + show_error!("{}", f.to_string()); return Err(1); } } diff --git a/uptime/uptime.rs b/uptime/uptime.rs index 774d46e78..cdd1b82c2 100644 --- a/uptime/uptime.rs +++ b/uptime/uptime.rs @@ -154,7 +154,7 @@ fn print_time() { fn get_uptime(boot_time: Option) -> i64 { let proc_uptime = File::open(&Path::new("/proc/uptime")) - .read_to_str(); + .read_to_string(); let uptime_text = match proc_uptime { Ok(s) => s, diff --git a/wc/wc.rs b/wc/wc.rs index a3f01ca3c..110369659 100644 --- a/wc/wc.rs +++ b/wc/wc.rs @@ -177,7 +177,7 @@ pub fn wc(files: Vec, matches: &Matches) -> StdResult<(), int> { } // used for formatting - max_str_len = total_byte_count.to_str().len(); + max_str_len = total_byte_count.to_string().len(); } for result in results.iter() { @@ -240,7 +240,7 @@ fn open(path: String) -> StdResult>, int> { Ok(BufferedReader::new(reader)) }, Err(e) => { - show_error!("wc: {0:s}: {1:s}", path, e.desc.to_str()); + show_error!("wc: {0:s}: {1:s}", path, e.desc.to_string()); Err(1) } }