Skip to content

Commit 3bab3dc

Browse files
committed
libstd: Remove all uses of {:?}.
1 parent 814586b commit 3bab3dc

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

src/libstd/dynamic_lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ mod test {
183183
let expected_result = 1.0;
184184
let result = cosine(argument);
185185
if result != expected_result {
186-
fail!("cos({:?}) != {:?} but equaled {:?} instead", argument,
186+
fail!("cos({}) != {} but equaled {} instead", argument,
187187
expected_result, result)
188188
}
189189
}

src/libstd/io/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ mod test {
963963

964964
macro_rules! error( ($e:expr, $s:expr) => (
965965
match $e {
966-
Ok(val) => fail!("Should have been an error, was {:?}", val),
966+
Ok(val) => fail!("Unexpected success. Should've been: {}", $s),
967967
Err(ref err) => assert!(err.to_string().as_slice().contains($s.as_slice()),
968968
format!("`{}` did not contain `{}`", err, $s))
969969
}

src/libstd/io/net/pipe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ mod tests {
340340
assert!(e.kind == BrokenPipe ||
341341
e.kind == NotConnected ||
342342
e.kind == ConnectionReset,
343-
"unknown error {:?}", e);
343+
"unknown error {}", e);
344344
break;
345345
}
346346
}

src/libstd/os.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,7 +1975,7 @@ mod tests {
19751975
let path = os::self_exe_name();
19761976
assert!(path.is_some());
19771977
let path = path.unwrap();
1978-
debug!("{:?}", path.clone());
1978+
debug!("{}", path.display());
19791979

19801980
// Hard to test this function
19811981
assert!(path.is_absolute());
@@ -1986,7 +1986,7 @@ mod tests {
19861986
let path = os::self_exe_path();
19871987
assert!(path.is_some());
19881988
let path = path.unwrap();
1989-
debug!("{:?}", path.clone());
1989+
debug!("{}", path.display());
19901990

19911991
// Hard to test this function
19921992
assert!(path.is_absolute());
@@ -1999,7 +1999,7 @@ mod tests {
19991999
assert!(e.len() > 0u);
20002000
for p in e.iter() {
20012001
let (n, v) = (*p).clone();
2002-
debug!("{:?}", n.clone());
2002+
debug!("{}", n);
20032003
let v2 = getenv(n.as_slice());
20042004
// MingW seems to set some funky environment variables like
20052005
// "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned
@@ -2037,8 +2037,8 @@ mod tests {
20372037
let cwd = getcwd();
20382038
debug!("Current working directory: {}", cwd.display());
20392039

2040-
debug!("{:?}", make_absolute(&Path::new("test-path")));
2041-
debug!("{:?}", make_absolute(&Path::new("/usr/bin")));
2040+
debug!("{}", make_absolute(&Path::new("test-path")).display());
2041+
debug!("{}", make_absolute(&Path::new("/usr/bin")).display());
20422042
}
20432043

20442044
#[test]

src/libstd/path/posix.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -986,19 +986,19 @@ mod tests {
986986
let path = $path;
987987
let filename = $filename;
988988
assert!(path.filename_str() == filename,
989-
"{}.filename_str(): Expected `{:?}`, found {:?}",
989+
"{}.filename_str(): Expected `{}`, found {}",
990990
path.as_str().unwrap(), filename, path.filename_str());
991991
let dirname = $dirname;
992992
assert!(path.dirname_str() == dirname,
993-
"`{}`.dirname_str(): Expected `{:?}`, found `{:?}`",
993+
"`{}`.dirname_str(): Expected `{}`, found `{}`",
994994
path.as_str().unwrap(), dirname, path.dirname_str());
995995
let filestem = $filestem;
996996
assert!(path.filestem_str() == filestem,
997-
"`{}`.filestem_str(): Expected `{:?}`, found `{:?}`",
997+
"`{}`.filestem_str(): Expected `{}`, found `{}`",
998998
path.as_str().unwrap(), filestem, path.filestem_str());
999999
let ext = $ext;
10001000
assert!(path.extension_str() == mem::transmute(ext),
1001-
"`{}`.extension_str(): Expected `{:?}`, found `{:?}`",
1001+
"`{}`.extension_str(): Expected `{}`, found `{}`",
10021002
path.as_str().unwrap(), ext, path.extension_str());
10031003
}
10041004
}
@@ -1200,11 +1200,11 @@ mod tests {
12001200
let comps = path.components().collect::<Vec<&[u8]>>();
12011201
let exp: &[&str] = $exp;
12021202
let exps = exp.iter().map(|x| x.as_bytes()).collect::<Vec<&[u8]>>();
1203-
assert!(comps == exps, "components: Expected {:?}, found {:?}",
1203+
assert!(comps == exps, "components: Expected {}, found {}",
12041204
comps, exps);
12051205
let comps = path.components().rev().collect::<Vec<&[u8]>>();
12061206
let exps = exps.into_iter().rev().collect::<Vec<&[u8]>>();
1207-
assert!(comps == exps, "rev_components: Expected {:?}, found {:?}",
1207+
assert!(comps == exps, "rev_components: Expected {}, found {}",
12081208
comps, exps);
12091209
}
12101210
);

src/libstd/path/windows.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ pub fn is_sep_byte_verbatim(u: &u8) -> bool {
996996
}
997997

998998
/// Prefix types for Path
999-
#[deriving(PartialEq, Clone)]
999+
#[deriving(PartialEq, Clone, Show)]
10001000
pub enum PathPrefix {
10011001
/// Prefix `\\?\`, uint is the length of the following component
10021002
VerbatimPrefix(uint),
@@ -1172,7 +1172,7 @@ mod tests {
11721172
let exp = $exp;
11731173
let res = parse_prefix(path);
11741174
assert!(res == exp,
1175-
"parse_prefix(\"{}\"): expected {:?}, found {:?}", path, exp, res);
1175+
"parse_prefix(\"{}\"): expected {}, found {}", path, exp, res);
11761176
}
11771177
)
11781178
)
@@ -1904,19 +1904,19 @@ mod tests {
19041904
let path = $path;
19051905
let filename = $filename;
19061906
assert!(path.filename_str() == filename,
1907-
"`{}`.filename_str(): Expected `{:?}`, found `{:?}`",
1907+
"`{}`.filename_str(): Expected `{}`, found `{}`",
19081908
path.as_str().unwrap(), filename, path.filename_str());
19091909
let dirname = $dirname;
19101910
assert!(path.dirname_str() == dirname,
1911-
"`{}`.dirname_str(): Expected `{:?}`, found `{:?}`",
1911+
"`{}`.dirname_str(): Expected `{}`, found `{}`",
19121912
path.as_str().unwrap(), dirname, path.dirname_str());
19131913
let filestem = $filestem;
19141914
assert!(path.filestem_str() == filestem,
1915-
"`{}`.filestem_str(): Expected `{:?}`, found `{:?}`",
1915+
"`{}`.filestem_str(): Expected `{}`, found `{}`",
19161916
path.as_str().unwrap(), filestem, path.filestem_str());
19171917
let ext = $ext;
19181918
assert!(path.extension_str() == mem::transmute(ext),
1919-
"`{}`.extension_str(): Expected `{:?}`, found `{:?}`",
1919+
"`{}`.extension_str(): Expected `{}`, found `{}`",
19201920
path.as_str().unwrap(), ext, path.extension_str());
19211921
}
19221922
}
@@ -1974,16 +1974,16 @@ mod tests {
19741974
let path = Path::new($path);
19751975
let (abs, vol, cwd, rel) = ($abs, $vol, $cwd, $rel);
19761976
let b = path.is_absolute();
1977-
assert!(b == abs, "Path '{}'.is_absolute(): expected {:?}, found {:?}",
1977+
assert!(b == abs, "Path '{}'.is_absolute(): expected {}, found {}",
19781978
path.as_str().unwrap(), abs, b);
19791979
let b = is_vol_relative(&path);
1980-
assert!(b == vol, "is_vol_relative('{}'): expected {:?}, found {:?}",
1980+
assert!(b == vol, "is_vol_relative('{}'): expected {}, found {}",
19811981
path.as_str().unwrap(), vol, b);
19821982
let b = is_cwd_relative(&path);
1983-
assert!(b == cwd, "is_cwd_relative('{}'): expected {:?}, found {:?}",
1983+
assert!(b == cwd, "is_cwd_relative('{}'): expected {}, found {}",
19841984
path.as_str().unwrap(), cwd, b);
19851985
let b = path.is_relative();
1986-
assert!(b == rel, "Path '{}'.is_relativf(): expected {:?}, found {:?}",
1986+
assert!(b == rel, "Path '{}'.is_relativf(): expected {}, found {}",
19871987
path.as_str().unwrap(), rel, b);
19881988
}
19891989
)
@@ -2016,7 +2016,7 @@ mod tests {
20162016
let exp = $exp;
20172017
let res = path.is_ancestor_of(&dest);
20182018
assert!(res == exp,
2019-
"`{}`.is_ancestor_of(`{}`): Expected {:?}, found {:?}",
2019+
"`{}`.is_ancestor_of(`{}`): Expected {}, found {}",
20202020
path.as_str().unwrap(), dest.as_str().unwrap(), exp, res);
20212021
}
20222022
)
@@ -2151,7 +2151,7 @@ mod tests {
21512151
let res = path.path_relative_from(&other);
21522152
let exp = $exp;
21532153
assert!(res.as_ref().and_then(|x| x.as_str()) == exp,
2154-
"`{}`.path_relative_from(`{}`): Expected {:?}, got {:?}",
2154+
"`{}`.path_relative_from(`{}`): Expected {}, got {}",
21552155
path.as_str().unwrap(), other.as_str().unwrap(), exp,
21562156
res.as_ref().and_then(|x| x.as_str()));
21572157
}

0 commit comments

Comments
 (0)