Skip to content

Commit

Permalink
libstd: Remove all uses of {:?}.
Browse files Browse the repository at this point in the history
  • Loading branch information
luqmana committed Oct 16, 2014
1 parent 814586b commit 3bab3dc
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/libstd/dynamic_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/io/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/io/net/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ mod tests {
assert!(e.kind == BrokenPipe ||
e.kind == NotConnected ||
e.kind == ConnectionReset,
"unknown error {:?}", e);
"unknown error {}", e);
break;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/libstd/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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
Expand Down Expand Up @@ -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]
Expand Down
12 changes: 6 additions & 6 deletions src/libstd/path/posix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down Expand Up @@ -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);
}
);
Expand Down
24 changes: 12 additions & 12 deletions src/libstd/path/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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);
}
)
)
Expand Down Expand Up @@ -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());
}
}
Expand Down Expand Up @@ -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);
}
)
Expand Down Expand Up @@ -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);
}
)
Expand Down Expand Up @@ -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()));
}
Expand Down

0 comments on commit 3bab3dc

Please sign in to comment.