diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-11-27 19:45:47 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-06 23:53:02 -0500 |
| commit | c2da923fc95e29424a7dac1505d6e8ea50c49b9f (patch) | |
| tree | 8b47144a56039b4a53519513bce60aa74c1dcf51 /src/libstd/io | |
| parent | ba01ea3730025028affbf4ce56f29621861779c6 (diff) | |
| download | rust-c2da923fc95e29424a7dac1505d6e8ea50c49b9f.tar.gz rust-c2da923fc95e29424a7dac1505d6e8ea50c49b9f.zip | |
libstd: remove unnecessary `to_string()` calls
Diffstat (limited to 'src/libstd/io')
| -rw-r--r-- | src/libstd/io/mem.rs | 4 | ||||
| -rw-r--r-- | src/libstd/io/mod.rs | 16 | ||||
| -rw-r--r-- | src/libstd/io/net/ip.rs | 6 | ||||
| -rw-r--r-- | src/libstd/io/process.rs | 10 | ||||
| -rw-r--r-- | src/libstd/io/stdio.rs | 2 |
5 files changed, 19 insertions, 19 deletions
diff --git a/src/libstd/io/mem.rs b/src/libstd/io/mem.rs index c48f487c95c..078daf8feca 100644 --- a/src/libstd/io/mem.rs +++ b/src/libstd/io/mem.rs @@ -592,7 +592,7 @@ mod test { writer.write_line("testing").unwrap(); writer.write_str("testing").unwrap(); let mut r = BufReader::new(writer.get_ref()); - assert_eq!(r.read_to_string().unwrap(), "testingtesting\ntesting".to_string()); + assert_eq!(r.read_to_string().unwrap(), "testingtesting\ntesting"); } #[test] @@ -602,7 +602,7 @@ mod test { writer.write_char('\n').unwrap(); writer.write_char('ệ').unwrap(); let mut r = BufReader::new(writer.get_ref()); - assert_eq!(r.read_to_string().unwrap(), "a\nệ".to_string()); + assert_eq!(r.read_to_string().unwrap(), "a\nệ"); } #[test] diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 5a56636ffa4..a9e653e267a 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -2005,14 +2005,14 @@ mod tests { fn test_show() { use super::*; - assert_eq!(format!("{}", USER_READ), "0400".to_string()); - assert_eq!(format!("{}", USER_FILE), "0644".to_string()); - assert_eq!(format!("{}", USER_EXEC), "0755".to_string()); - assert_eq!(format!("{}", USER_RWX), "0700".to_string()); - assert_eq!(format!("{}", GROUP_RWX), "0070".to_string()); - assert_eq!(format!("{}", OTHER_RWX), "0007".to_string()); - assert_eq!(format!("{}", ALL_PERMISSIONS), "0777".to_string()); - assert_eq!(format!("{}", USER_READ | USER_WRITE | OTHER_WRITE), "0602".to_string()); + assert_eq!(format!("{}", USER_READ), "0400"); + assert_eq!(format!("{}", USER_FILE), "0644"); + assert_eq!(format!("{}", USER_EXEC), "0755"); + assert_eq!(format!("{}", USER_RWX), "0700"); + assert_eq!(format!("{}", GROUP_RWX), "0070"); + assert_eq!(format!("{}", OTHER_RWX), "0007"); + assert_eq!(format!("{}", ALL_PERMISSIONS), "0777"); + assert_eq!(format!("{}", USER_READ | USER_WRITE | OTHER_WRITE), "0602"); } fn _ensure_buffer_is_object_safe<T: Buffer>(x: &T) -> &Buffer { diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 4812e911cc4..20e2753392c 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -640,10 +640,10 @@ mod test { #[test] fn ipv6_addr_to_string() { let a1 = Ipv6Addr(0, 0, 0, 0, 0, 0xffff, 0xc000, 0x280); - assert!(a1.to_string() == "::ffff:192.0.2.128".to_string() || - a1.to_string() == "::FFFF:192.0.2.128".to_string()); + assert!(a1.to_string() == "::ffff:192.0.2.128" || + a1.to_string() == "::FFFF:192.0.2.128"); assert_eq!(Ipv6Addr(8, 9, 10, 11, 12, 13, 14, 15).to_string(), - "8:9:a:b:c:d:e:f".to_string()); + "8:9:a:b:c:d:e:f"); } #[test] diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index 53c672b4302..a4ca77e92fa 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -810,7 +810,7 @@ mod tests { fn stdout_works() { let mut cmd = Command::new("echo"); cmd.arg("foobar").stdout(CreatePipe(false, true)); - assert_eq!(run_output(cmd), "foobar\n".to_string()); + assert_eq!(run_output(cmd), "foobar\n"); } #[cfg(all(unix, not(target_os="android")))] @@ -820,7 +820,7 @@ mod tests { cmd.arg("-c").arg("pwd") .cwd(&Path::new("/")) .stdout(CreatePipe(false, true)); - assert_eq!(run_output(cmd), "/\n".to_string()); + assert_eq!(run_output(cmd), "/\n"); } #[cfg(all(unix, not(target_os="android")))] @@ -835,7 +835,7 @@ mod tests { drop(p.stdin.take()); let out = read_all(p.stdout.as_mut().unwrap() as &mut Reader); assert!(p.wait().unwrap().success()); - assert_eq!(out, "foobar\n".to_string()); + assert_eq!(out, "foobar\n"); } #[cfg(not(target_os="android"))] @@ -900,7 +900,7 @@ mod tests { let output_str = str::from_utf8(output.as_slice()).unwrap(); assert!(status.success()); - assert_eq!(output_str.trim().to_string(), "hello".to_string()); + assert_eq!(output_str.trim().to_string(), "hello"); // FIXME #7224 if !running_on_valgrind() { assert_eq!(error, Vec::new()); @@ -941,7 +941,7 @@ mod tests { let output_str = str::from_utf8(output.as_slice()).unwrap(); assert!(status.success()); - assert_eq!(output_str.trim().to_string(), "hello".to_string()); + assert_eq!(output_str.trim().to_string(), "hello"); // FIXME #7224 if !running_on_valgrind() { assert_eq!(error, Vec::new()); diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 89d5b7a8acd..fce1ee7e9b4 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -527,7 +527,7 @@ mod tests { set_stdout(box w); println!("hello!"); }); - assert_eq!(r.read_to_string().unwrap(), "hello!\n".to_string()); + assert_eq!(r.read_to_string().unwrap(), "hello!\n"); } #[test] |
