diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-09-27 17:02:31 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-09-30 23:21:18 -0700 |
| commit | a8ba31dbf3e7d80a069bc486a35eff8357282b68 (patch) | |
| tree | 8a00829d527c443d16988b98cd7c97f1d3d4dac6 /src/libstd/unstable | |
| parent | aaf6cc3a841095a95a9c74a6a2a3709dffd7a4e9 (diff) | |
| download | rust-a8ba31dbf3e7d80a069bc486a35eff8357282b68.tar.gz rust-a8ba31dbf3e7d80a069bc486a35eff8357282b68.zip | |
std: Remove usage of fmt!
Diffstat (limited to 'src/libstd/unstable')
| -rw-r--r-- | src/libstd/unstable/dynamic_lib.rs | 12 | ||||
| -rw-r--r-- | src/libstd/unstable/extfmt.rs | 6 | ||||
| -rw-r--r-- | src/libstd/unstable/finally.rs | 2 | ||||
| -rw-r--r-- | src/libstd/unstable/lang.rs | 4 | ||||
| -rw-r--r-- | src/libstd/unstable/sync.rs | 6 |
5 files changed, 15 insertions, 15 deletions
diff --git a/src/libstd/unstable/dynamic_lib.rs b/src/libstd/unstable/dynamic_lib.rs index 41ff79bc884..0045aef06f1 100644 --- a/src/libstd/unstable/dynamic_lib.rs +++ b/src/libstd/unstable/dynamic_lib.rs @@ -33,7 +33,7 @@ impl Drop for DynamicLibrary { } } { Ok(()) => {}, - Err(str) => fail!(str) + Err(str) => fail2!("{}", str) } } } @@ -96,7 +96,7 @@ mod test { // The math library does not need to be loaded since it is already // statically linked in let libm = match DynamicLibrary::open(None) { - Err(error) => fail!("Could not load self as module: %s", error), + Err(error) => fail2!("Could not load self as module: {}", error), Ok(libm) => libm }; @@ -104,7 +104,7 @@ mod test { // this as a C function let cosine: extern fn(libc::c_double) -> libc::c_double = unsafe { match libm.symbol("cos") { - Err(error) => fail!("Could not load function cos: %s", error), + Err(error) => fail2!("Could not load function cos: {}", error), Ok(cosine) => cosine } }; @@ -113,7 +113,7 @@ mod test { let expected_result = 1.0; let result = cosine(argument); if result != expected_result { - fail!("cos(%?) != %? but equaled %? instead", argument, + fail2!("cos({:?}) != {:?} but equaled {:?} instead", argument, expected_result, result) } } @@ -129,7 +129,7 @@ mod test { let path = GenericPath::from_str("/dev/null"); match DynamicLibrary::open(Some(&path)) { Err(_) => {} - Ok(_) => fail!("Successfully opened the empty library.") + Ok(_) => fail2!("Successfully opened the empty library.") } } } @@ -241,7 +241,7 @@ pub mod dl { if 0 == error { Ok(result) } else { - Err(fmt!("Error code %?", error)) + Err(format!("Error code {}", error)) } } } diff --git a/src/libstd/unstable/extfmt.rs b/src/libstd/unstable/extfmt.rs index 4d53dd7d7bf..b224c22df20 100644 --- a/src/libstd/unstable/extfmt.rs +++ b/src/libstd/unstable/extfmt.rs @@ -333,14 +333,14 @@ pub mod ct { 'f' => TyFloat, 'p' => TyPointer, '?' => TyPoly, - _ => err(fmt!("unknown type in conversion: %c", s.char_at(i))) + _ => err(format!("unknown type in conversion: {}", s.char_at(i))) }; Parsed::new(t, i + 1) } #[cfg(test)] - fn die(s: &str) -> ! { fail!(s.to_owned()) } + fn die(s: &str) -> ! { fail2!(s.to_owned()) } #[test] fn test_parse_count() { @@ -698,6 +698,6 @@ mod test { #[test] fn fmt_slice() { let s = "abc"; - let _s = fmt!("%s", s); + let _s = format!("{}", s); } } diff --git a/src/libstd/unstable/finally.rs b/src/libstd/unstable/finally.rs index c1365a44bc9..9fe3435c21b 100644 --- a/src/libstd/unstable/finally.rs +++ b/src/libstd/unstable/finally.rs @@ -87,7 +87,7 @@ fn test_fail() { let mut i = 0; do (|| { i = 10; - fail!(); + fail2!(); }).finally { assert!(failing()); assert_eq!(i, 10); diff --git a/src/libstd/unstable/lang.rs b/src/libstd/unstable/lang.rs index b2a0062d727..fca477763c5 100644 --- a/src/libstd/unstable/lang.rs +++ b/src/libstd/unstable/lang.rs @@ -27,8 +27,8 @@ pub fn fail_(expr: *c_char, file: *c_char, line: size_t) -> ! { #[lang="fail_bounds_check"] pub fn fail_bounds_check(file: *c_char, line: size_t, index: size_t, len: size_t) { - let msg = fmt!("index out of bounds: the len is %d but the index is %d", - len as int, index as int); + let msg = format!("index out of bounds: the len is {} but the index is {}", + len as int, index as int); do msg.with_c_str |buf| { fail_(buf, file, line); } diff --git a/src/libstd/unstable/sync.rs b/src/libstd/unstable/sync.rs index c2ef2300fc2..066c2173b5a 100644 --- a/src/libstd/unstable/sync.rs +++ b/src/libstd/unstable/sync.rs @@ -172,7 +172,7 @@ impl<T: Send> UnsafeArc<T> { // If 'put' returns the server end back to us, we were rejected; // someone else was trying to unwrap. Avoid guaranteed deadlock. cast::forget(data); - fail!("Another task is already unwrapping this Arc!"); + fail2!("Another task is already unwrapping this Arc!"); } } } @@ -386,7 +386,7 @@ impl<T:Send> Exclusive<T> { let rec = self.x.get(); do (*rec).lock.lock { if (*rec).failed { - fail!("Poisoned Exclusive::new - another task failed inside!"); + fail2!("Poisoned Exclusive::new - another task failed inside!"); } (*rec).failed = true; let result = f(&mut (*rec).data); @@ -618,7 +618,7 @@ mod tests { let x2 = x.clone(); do task::spawn { do 10.times { task::deschedule(); } // try to let the unwrapper go - fail!(); // punt it awake from its deadlock + fail2!(); // punt it awake from its deadlock } let _z = x.unwrap(); unsafe { do x2.with |_hello| { } } |
