diff options
| author | bors <bors@rust-lang.org> | 2014-10-16 17:52:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-10-16 17:52:25 +0000 |
| commit | 8b979739713f54eb9315ed5f88b8f06d43d0bbb5 (patch) | |
| tree | aa374aaa783ed319e49592dcd40cf7b6416d53b8 /src/libstd | |
| parent | b6e0d3a5bf4c88650a22f605f822e02c6b163580 (diff) | |
| parent | 78992485047f7600a0d34c5f573b30be262b2e4b (diff) | |
| download | rust-8b979739713f54eb9315ed5f88b8f06d43d0bbb5.tar.gz rust-8b979739713f54eb9315ed5f88b8f06d43d0bbb5.zip | |
auto merge of #18064 : luqmana/rust/remove-reflection, r=nick29581
Out goes reflection! This means your code will break if you used the `:?` format specifier, anything else from libdebug, or the `visit_tydesc` intrinsic directly. Closes #18046. [breaking-change]
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/dynamic_lib.rs | 2 | ||||
| -rw-r--r-- | src/libstd/fmt.rs | 11 | ||||
| -rw-r--r-- | src/libstd/io/fs.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/net/pipe.rs | 2 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 1 | ||||
| -rw-r--r-- | src/libstd/os.rs | 10 | ||||
| -rw-r--r-- | src/libstd/path/posix.rs | 12 | ||||
| -rw-r--r-- | src/libstd/path/windows.rs | 24 |
8 files changed, 28 insertions, 36 deletions
diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index bc71f8ae790..ed8ff821f5c 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -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) } } diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs index f69f94c4db6..27451c91f3f 100644 --- a/src/libstd/fmt.rs +++ b/src/libstd/fmt.rs @@ -36,12 +36,11 @@ format arguments directly while performing minimal allocations. Some examples of the `format!` extension are: ```rust -# extern crate debug; # fn main() { format!("Hello"); // => "Hello" format!("Hello, {:s}!", "world"); // => "Hello, world!" format!("The number is {:d}", 1i); // => "The number is 1" -format!("{:?}", (3i, 4i)); // => "(3, 4)" +format!("{}", (3i, 4i)); // => "(3, 4)" format!("{value}", value=4i); // => "4" format!("{} {}", 1i, 2i); // => "1 2" # } @@ -94,11 +93,10 @@ identifier '=' expression For example, the following `format!` expressions all use named argument: ```rust -# extern crate debug; # fn main() { format!("{argument}", argument = "test"); // => "test" format!("{name} {}", 1i, name = 2i); // => "2 1" -format!("{a:s} {c:d} {b:?}", a="a", b=(), c=3i); // => "a 3 ()" +format!("{a:s} {c:d} {b}", a="a", b=(), c=3i); // => "a 3 ()" # } ``` @@ -154,11 +152,6 @@ The current mapping of types to traits is: * `f` ⇒ `Float` * `e` ⇒ `LowerExp` * `E` ⇒ `UpperExp` -* `?` ⇒ `Poly` - -> **Note**: The `Poly` formatting trait is provided by [libdebug](../../debug/) -> and is an experimental implementation that should not be relied upon. In order -> to use the `?` modifier, the libdebug crate must be linked against. What this means is that any type of argument which implements the `std::fmt::Binary` trait can then be formatted with `{:t}`. Implementations are diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index e8fed67fffe..8632fc63e52 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -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)) } diff --git a/src/libstd/io/net/pipe.rs b/src/libstd/io/net/pipe.rs index 3f8069468f6..e0cf761fdbd 100644 --- a/src/libstd/io/net/pipe.rs +++ b/src/libstd/io/net/pipe.rs @@ -340,7 +340,7 @@ mod tests { assert!(e.kind == BrokenPipe || e.kind == NotConnected || e.kind == ConnectionReset, - "unknown error {:?}", e); + "unknown error {}", e); break; } } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 13adfeecf85..82c8d8071b3 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -118,7 +118,6 @@ #![reexport_test_harness_main = "test_main"] #[cfg(test)] extern crate green; -#[cfg(test)] extern crate debug; #[cfg(test)] #[phase(plugin, link)] extern crate log; extern crate alloc; diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 03eca5c728b..e758dec6bff 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -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] diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 27eafdab642..69b6dd76676 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -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); } ); diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 5bd738ed58b..4456cf96094 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -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())); } |
