diff options
| author | Kevin Butler <haqkrs@gmail.com> | 2015-02-13 07:33:44 +0000 |
|---|---|---|
| committer | Kevin Butler <haqkrs@gmail.com> | 2015-02-18 00:56:07 +0000 |
| commit | 2f586b9687e5c33d9d3b8eccfc309f65d2a9f4e9 (patch) | |
| tree | 578e2d49b5c8b71d7c38142adcf6d10dba09d690 /src/libstd | |
| parent | 5705d48e280f8a0065c214edfb3dcdcecc323316 (diff) | |
| download | rust-2f586b9687e5c33d9d3b8eccfc309f65d2a9f4e9.tar.gz rust-2f586b9687e5c33d9d3b8eccfc309f65d2a9f4e9.zip | |
Opt for .cloned() over .map(|x| x.clone()) etc.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/env.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/env.rs b/src/libstd/env.rs index ea18838211f..bfc1afc6eb4 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -918,7 +918,7 @@ mod tests { #[cfg(unix)] fn join_paths_unix() { fn test_eq(input: &[&str], output: &str) -> bool { - &*join_paths(input.iter().map(|s| *s)).unwrap() == + &*join_paths(input.iter().cloned()).unwrap() == OsStr::from_str(output) } @@ -927,14 +927,14 @@ mod tests { "/bin:/usr/bin:/usr/local/bin")); assert!(test_eq(&["", "/bin", "", "", "/usr/bin", ""], ":/bin:::/usr/bin:")); - assert!(join_paths(["/te:st"].iter().map(|s| *s)).is_err()); + assert!(join_paths(["/te:st"].iter().cloned()).is_err()); } #[test] #[cfg(windows)] fn join_paths_windows() { fn test_eq(input: &[&str], output: &str) -> bool { - &*join_paths(input.iter().map(|s| *s)).unwrap() == + &*join_paths(input.iter().cloned()).unwrap() == OsStr::from_str(output) } @@ -945,6 +945,6 @@ mod tests { r";c:\windows;;;c:\;")); assert!(test_eq(&[r"c:\te;st", r"c:\"], r#""c:\te;st";c:\"#)); - assert!(join_paths([r#"c:\te"st"#].iter().map(|s| *s)).is_err()); + assert!(join_paths([r#"c:\te"st"#].iter().cloned()).is_err()); } } |
