libstd: Remove all uses of {:?}.

This commit is contained in:
Luqman Aden 2014-10-15 03:07:48 -04:00
parent 814586be57
commit 3bab3dc574
6 changed files with 26 additions and 26 deletions

View File

@ -183,7 +183,7 @@ mod test {
let expected_result = 1.0;
let result = cosine(argument);
if result != expected_result {
fail!("cos({:?}) != {:?} but equaled {:?} instead", argument,
fail!("cos({}) != {} but equaled {} instead", argument,
expected_result, result)
}
}

View File

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

View File

@ -340,7 +340,7 @@ mod tests {
assert!(e.kind == BrokenPipe ||
e.kind == NotConnected ||
e.kind == ConnectionReset,
"unknown error {:?}", e);
"unknown error {}", e);
break;
}
}

View File

@ -1975,7 +1975,7 @@ mod tests {
let path = os::self_exe_name();
assert!(path.is_some());
let path = path.unwrap();
debug!("{:?}", path.clone());
debug!("{}", path.display());
// Hard to test this function
assert!(path.is_absolute());
@ -1986,7 +1986,7 @@ mod tests {
let path = os::self_exe_path();
assert!(path.is_some());
let path = path.unwrap();
debug!("{:?}", path.clone());
debug!("{}", path.display());
// Hard to test this function
assert!(path.is_absolute());
@ -1999,7 +1999,7 @@ mod tests {
assert!(e.len() > 0u);
for p in e.iter() {
let (n, v) = (*p).clone();
debug!("{:?}", n.clone());
debug!("{}", n);
let v2 = getenv(n.as_slice());
// MingW seems to set some funky environment variables like
// "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned
@ -2037,8 +2037,8 @@ mod tests {
let cwd = getcwd();
debug!("Current working directory: {}", cwd.display());
debug!("{:?}", make_absolute(&Path::new("test-path")));
debug!("{:?}", make_absolute(&Path::new("/usr/bin")));
debug!("{}", make_absolute(&Path::new("test-path")).display());
debug!("{}", make_absolute(&Path::new("/usr/bin")).display());
}
#[test]

View File

@ -986,19 +986,19 @@ mod tests {
let path = $path;
let filename = $filename;
assert!(path.filename_str() == filename,
"{}.filename_str(): Expected `{:?}`, found {:?}",
"{}.filename_str(): Expected `{}`, found {}",
path.as_str().unwrap(), filename, path.filename_str());
let dirname = $dirname;
assert!(path.dirname_str() == dirname,
"`{}`.dirname_str(): Expected `{:?}`, found `{:?}`",
"`{}`.dirname_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), dirname, path.dirname_str());
let filestem = $filestem;
assert!(path.filestem_str() == filestem,
"`{}`.filestem_str(): Expected `{:?}`, found `{:?}`",
"`{}`.filestem_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), filestem, path.filestem_str());
let ext = $ext;
assert!(path.extension_str() == mem::transmute(ext),
"`{}`.extension_str(): Expected `{:?}`, found `{:?}`",
"`{}`.extension_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), ext, path.extension_str());
}
}
@ -1200,11 +1200,11 @@ mod tests {
let comps = path.components().collect::<Vec<&[u8]>>();
let exp: &[&str] = $exp;
let exps = exp.iter().map(|x| x.as_bytes()).collect::<Vec<&[u8]>>();
assert!(comps == exps, "components: Expected {:?}, found {:?}",
assert!(comps == exps, "components: Expected {}, found {}",
comps, exps);
let comps = path.components().rev().collect::<Vec<&[u8]>>();
let exps = exps.into_iter().rev().collect::<Vec<&[u8]>>();
assert!(comps == exps, "rev_components: Expected {:?}, found {:?}",
assert!(comps == exps, "rev_components: Expected {}, found {}",
comps, exps);
}
);

View File

@ -996,7 +996,7 @@ pub fn is_sep_byte_verbatim(u: &u8) -> bool {
}
/// Prefix types for Path
#[deriving(PartialEq, Clone)]
#[deriving(PartialEq, Clone, Show)]
pub enum PathPrefix {
/// Prefix `\\?\`, uint is the length of the following component
VerbatimPrefix(uint),
@ -1172,7 +1172,7 @@ mod tests {
let exp = $exp;
let res = parse_prefix(path);
assert!(res == exp,
"parse_prefix(\"{}\"): expected {:?}, found {:?}", path, exp, res);
"parse_prefix(\"{}\"): expected {}, found {}", path, exp, res);
}
)
)
@ -1904,19 +1904,19 @@ mod tests {
let path = $path;
let filename = $filename;
assert!(path.filename_str() == filename,
"`{}`.filename_str(): Expected `{:?}`, found `{:?}`",
"`{}`.filename_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), filename, path.filename_str());
let dirname = $dirname;
assert!(path.dirname_str() == dirname,
"`{}`.dirname_str(): Expected `{:?}`, found `{:?}`",
"`{}`.dirname_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), dirname, path.dirname_str());
let filestem = $filestem;
assert!(path.filestem_str() == filestem,
"`{}`.filestem_str(): Expected `{:?}`, found `{:?}`",
"`{}`.filestem_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), filestem, path.filestem_str());
let ext = $ext;
assert!(path.extension_str() == mem::transmute(ext),
"`{}`.extension_str(): Expected `{:?}`, found `{:?}`",
"`{}`.extension_str(): Expected `{}`, found `{}`",
path.as_str().unwrap(), ext, path.extension_str());
}
}
@ -1974,16 +1974,16 @@ mod tests {
let path = Path::new($path);
let (abs, vol, cwd, rel) = ($abs, $vol, $cwd, $rel);
let b = path.is_absolute();
assert!(b == abs, "Path '{}'.is_absolute(): expected {:?}, found {:?}",
assert!(b == abs, "Path '{}'.is_absolute(): expected {}, found {}",
path.as_str().unwrap(), abs, b);
let b = is_vol_relative(&path);
assert!(b == vol, "is_vol_relative('{}'): expected {:?}, found {:?}",
assert!(b == vol, "is_vol_relative('{}'): expected {}, found {}",
path.as_str().unwrap(), vol, b);
let b = is_cwd_relative(&path);
assert!(b == cwd, "is_cwd_relative('{}'): expected {:?}, found {:?}",
assert!(b == cwd, "is_cwd_relative('{}'): expected {}, found {}",
path.as_str().unwrap(), cwd, b);
let b = path.is_relative();
assert!(b == rel, "Path '{}'.is_relativf(): expected {:?}, found {:?}",
assert!(b == rel, "Path '{}'.is_relativf(): expected {}, found {}",
path.as_str().unwrap(), rel, b);
}
)
@ -2016,7 +2016,7 @@ mod tests {
let exp = $exp;
let res = path.is_ancestor_of(&dest);
assert!(res == exp,
"`{}`.is_ancestor_of(`{}`): Expected {:?}, found {:?}",
"`{}`.is_ancestor_of(`{}`): Expected {}, found {}",
path.as_str().unwrap(), dest.as_str().unwrap(), exp, res);
}
)
@ -2151,7 +2151,7 @@ mod tests {
let res = path.path_relative_from(&other);
let exp = $exp;
assert!(res.as_ref().and_then(|x| x.as_str()) == exp,
"`{}`.path_relative_from(`{}`): Expected {:?}, got {:?}",
"`{}`.path_relative_from(`{}`): Expected {}, got {}",
path.as_str().unwrap(), other.as_str().unwrap(), exp,
res.as_ref().and_then(|x| x.as_str()));
}