about summary refs log tree commit diff
path: root/src/libcore/str.rs
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2012-02-22 11:44:11 +0100
committerMarijn Haverbeke <marijnh@gmail.com>2012-02-22 11:47:47 +0100
commitad03761a97eb0f651e3ce4f54cbf87dbf4d6f80f (patch)
tree03eb60b2d440ebfc6b668e359c28fe0e8e69b042 /src/libcore/str.rs
parente57b6775c3a2d9dbe7fae69c189b8ae9032315cb (diff)
downloadrust-ad03761a97eb0f651e3ce4f54cbf87dbf4d6f80f.tar.gz
rust-ad03761a97eb0f651e3ce4f54cbf87dbf4d6f80f.zip
Remove preconditions from libraries
Closes #1805
Diffstat (limited to 'src/libcore/str.rs')
-rw-r--r--src/libcore/str.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 2c7c55418da..d81f2d45d40 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -659,7 +659,8 @@ Returns:
 
 The original string with all occurances of `from` replaced with `to`
 */
-fn replace(s: str, from: str, to: str) : is_not_empty(from) -> str unsafe {
+fn replace(s: str, from: str, to: str) -> str unsafe {
+    assert is_not_empty(from);
     if len_bytes(s) == 0u {
         ret "";
     } else if starts_with(s, from) {
@@ -1922,12 +1923,10 @@ mod tests {
     #[test]
     fn test_replace() {
         let a = "a";
-        check (is_not_empty(a));
         assert (replace("", a, "b") == "");
         assert (replace("a", a, "b") == "b");
         assert (replace("ab", a, "b") == "bb");
         let test = "test";
-        check (is_not_empty(test));
         assert (replace(" test test ", test, "toast") == " toast toast ");
         assert (replace(" test test ", test, "") == "   ");
     }
@@ -1939,7 +1938,6 @@ mod tests {
 
         let a = "ประเ";
         let A = "دولة الكويتทศไทย中华";
-        check is_not_empty(a);
         assert (replace(data, a, repl) ==  A);
     }
 
@@ -1950,7 +1948,6 @@ mod tests {
 
         let b = "ะเ";
         let B = "ปรدولة الكويتทศไทย中华";
-        check is_not_empty(b);
         assert (replace(data, b,   repl) ==  B);
     }
 
@@ -1961,7 +1958,6 @@ mod tests {
 
         let c = "中华";
         let C = "ประเทศไทยدولة الكويت";
-        check is_not_empty(c);
         assert (replace(data, c, repl) ==  C);
     }
 
@@ -1971,7 +1967,6 @@ mod tests {
         let repl = "دولة الكويت";
 
         let d = "ไท华";
-        check is_not_empty(d);
         assert (replace(data, d, repl) == data);
     }