summary refs log tree commit diff
path: root/src/libstd/sort.rs
diff options
context:
space:
mode:
authorBjörn Steinbrink <bsteinbr@gmail.com>2013-05-06 00:18:51 +0200
committerBjörn Steinbrink <bsteinbr@gmail.com>2013-05-14 16:36:23 +0200
commitbdc182cc41c2741edc6fdc4ec09b8522479aab40 (patch)
treee4d26bbc1b47702ef46cd01bbaa5b5dad8633416 /src/libstd/sort.rs
parent84745b483f322671f894b9e8d0a462c46275a9d3 (diff)
downloadrust-bdc182cc41c2741edc6fdc4ec09b8522479aab40.tar.gz
rust-bdc182cc41c2741edc6fdc4ec09b8522479aab40.zip
Use static string with fail!() and remove fail!(fmt!())
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
Diffstat (limited to 'src/libstd/sort.rs')
-rw-r--r--src/libstd/sort.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs
index 876eb716a38..0d94a1830a6 100644
--- a/src/libstd/sort.rs
+++ b/src/libstd/sort.rs
@@ -581,7 +581,7 @@ impl<T:Copy + Ord> MergeState<T> {
             shift_vec(array, dest, c2, len2);
             swap(&mut array[dest+len2], &mut tmp[c1]);
         } else if len1 == 0 {
-            fail!(~"Comparison violates its contract!");
+            fail!("Comparison violates its contract!");
         } else {
             assert!(len2 == 0);
             assert!(len1 > 1);
@@ -703,7 +703,7 @@ impl<T:Copy + Ord> MergeState<T> {
             shift_vec(array, dest+1, c1+1, len1);
             swap(&mut array[dest], &mut tmp[c2]);
         } else if len2 == 0 {
-            fail!(~"Comparison violates its contract!");
+            fail!("Comparison violates its contract!");
         } else {
             assert!(len1 == 0);
             assert!(len2 != 0);
@@ -949,7 +949,7 @@ mod test_tim_sort {
         fn lt(&self, other: &CVal) -> bool {
             let mut rng = rand::rng();
             if rng.gen::<float>() > 0.995 {
-                fail!(~"It's happening!!!");
+                fail!("It's happening!!!");
             }
             (*self).val < other.val
         }
@@ -1004,7 +1004,7 @@ mod test_tim_sort {
         };
 
         tim_sort(arr);
-        fail!(~"Guarantee the fail");
+        fail!("Guarantee the fail");
     }
 
     struct DVal { val: uint }
@@ -1065,7 +1065,7 @@ mod big_tests {
         fn isSorted<T:Ord>(arr: &[T]) {
             for uint::range(0, arr.len()-1) |i| {
                 if arr[i] > arr[i+1] {
-                    fail!(~"Array not sorted");
+                    fail!("Array not sorted");
                 }
             }
         }
@@ -1136,7 +1136,7 @@ mod big_tests {
         fn isSorted<T:Ord>(arr: &[@T]) {
             for uint::range(0, arr.len()-1) |i| {
                 if arr[i] > arr[i+1] {
-                    fail!(~"Array not sorted");
+                    fail!("Array not sorted");
                 }
             }
         }
@@ -1219,7 +1219,7 @@ mod big_tests {
                         local_data::local_data_set(self.key, @(y+1));
                     }
                 }
-                _ => fail!(~"Expected key to work"),
+                _ => fail!("Expected key to work"),
             }
         }
     }