about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-01-24 23:24:57 -0500
committerDaniel Micay <danielmicay@gmail.com>2013-01-24 23:24:57 -0500
commite4337a9defcad3f2a65da285ab78f8ede554f379 (patch)
tree21d2bff727548efa00e3cf7225ab9e43a9d5a2c7
parentec3f6e1932db297d2a575e591d4c508d785a0a52 (diff)
remove remaining is_not_empty functions/methods
-rw-r--r--src/compiletest/compiletest.rc2
-rw-r--r--src/libcore/dlist.rs4
-rw-r--r--src/libcore/str.rs13
-rw-r--r--src/libcore/util.rs2
-rw-r--r--src/libcore/vec.rs11
-rw-r--r--src/librustc/back/rpath.rs2
-rw-r--r--src/librustc/metadata/encoder.rs4
-rw-r--r--src/librustc/metadata/loader.rs2
-rw-r--r--src/librustc/middle/lint.rs2
-rw-r--r--src/librustdoc/attr_parser.rs2
-rw-r--r--src/librustdoc/desc_to_brief_pass.rs6
-rw-r--r--src/librustdoc/unindent_pass.rs2
-rw-r--r--src/libstd/list.rs9
-rw-r--r--src/libsyntax/attr.rs2
-rw-r--r--src/libsyntax/diagnostic.rs2
-rw-r--r--src/libsyntax/parse/parser.rs2
-rw-r--r--src/test/run-pass/non-boolean-pure-fns.rs2
-rw-r--r--src/test/run-pass/zip-same-length.rs2
18 files changed, 17 insertions, 54 deletions
diff --git a/src/compiletest/compiletest.rc b/src/compiletest/compiletest.rc
index a62e5ff9d32..82949bf200c 100644
--- a/src/compiletest/compiletest.rc
+++ b/src/compiletest/compiletest.rc
@@ -70,7 +70,7 @@ fn parse_config(args: ~[~str]) -> config {
           getopts::optopt(~"logfile"),
           getopts::optflag(~"jit")];
 
-    assert (vec::is_not_empty(args));
+    assert !args.is_empty();
     let args_ = vec::tail(args);
     let matches =
         &match getopts::getopts(args_, opts) {
diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs
index 4f0d76d69f3..bb41da432b5 100644
--- a/src/libcore/dlist.rs
+++ b/src/libcore/dlist.rs
@@ -208,8 +208,6 @@ impl<T> DList<T> {
     pure fn len(@self) -> uint { self.size }
     /// Returns true if the list is empty. O(1).
     pure fn is_empty(@self) -> bool { self.len() == 0 }
-    /// Returns true if the list is not empty. O(1).
-    pure fn is_not_empty(@self) -> bool { self.len() != 0 }
 
     /// Add data to the head of the list. O(1).
     fn push_head(@self, data: T) {
@@ -648,8 +646,6 @@ mod tests {
         let full1 = from_vec(~[1,2,3]);
         assert empty.is_empty();
         assert !full1.is_empty();
-        assert !empty.is_not_empty();
-        assert full1.is_not_empty();
     }
     #[test]
     fn test_dlist_head_tail() {
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 12246255b77..312bfab58c0 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -1419,9 +1419,6 @@ pub pure fn is_ascii(s: &str) -> bool {
 /// Returns true if the string has length 0
 pub pure fn is_empty(s: &str) -> bool { len(s) == 0u }
 
-/// Returns true if the string has length greater than 0
-pub pure fn is_not_empty(s: &str) -> bool { !is_empty(s) }
-
 /**
  * Returns true if the string contains only whitespace
  *
@@ -2167,7 +2164,6 @@ pub trait StrSlice {
     pure fn each_chari(it: fn(uint, char) -> bool);
     pure fn ends_with(needle: &str) -> bool;
     pure fn is_empty() -> bool;
-    pure fn is_not_empty() -> bool;
     pure fn is_whitespace() -> bool;
     pure fn is_alphanumeric() -> bool;
     pure fn len() -> uint;
@@ -2229,9 +2225,6 @@ impl &str: StrSlice {
     /// Returns true if the string has length 0
     #[inline]
     pure fn is_empty() -> bool { is_empty(self) }
-    /// Returns true if the string has length greater than 0
-    #[inline]
-    pure fn is_not_empty() -> bool { is_not_empty(self) }
     /**
      * Returns true if the string contains only whitespace
      *
@@ -2740,12 +2733,6 @@ mod tests {
     }
 
     #[test]
-    fn test_is_not_empty() {
-        assert (is_not_empty(~"a"));
-        assert (!is_not_empty(~""));
-    }
-
-    #[test]
     fn test_replace() {
         let a = ~"a";
         assert replace(~"", a, ~"b") == ~"";
diff --git a/src/libcore/util.rs b/src/libcore/util.rs
index 423dbaedf26..0faa72364f2 100644
--- a/src/libcore/util.rs
+++ b/src/libcore/util.rs
@@ -84,7 +84,7 @@ terminate normally, but instead directly return from a function.
 
 ~~~
 fn choose_weighted_item(v: &[Item]) -> Item {
-    assert v.is_not_empty();
+    assert !v.is_empty();
     let mut so_far = 0u;
     for v.each |item| {
         so_far += item.weight;
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs
index 7f6999e5163..e9d60d0f269 100644
--- a/src/libcore/vec.rs
+++ b/src/libcore/vec.rs
@@ -49,11 +49,6 @@ pub pure fn is_empty<T>(v: &[const T]) -> bool {
     as_const_buf(v, |_p, len| len == 0u)
 }
 
-/// Returns true if a vector contains some elements
-pub pure fn is_not_empty<T>(v: &[const T]) -> bool {
-    as_const_buf(v, |_p, len| len > 0u)
-}
-
 /// Returns true if two vectors have the same length
 pub pure fn same_length<T, U>(xs: &[const T], ys: &[const U]) -> bool {
     len(xs) == len(ys)
@@ -2516,12 +2511,6 @@ mod tests {
     }
 
     #[test]
-    fn test_is_not_empty() {
-        assert (is_not_empty(~[0]));
-        assert (!is_not_empty::<int>(~[]));
-    }
-
-    #[test]
     fn test_len_divzero() {
         type Z = [i8 * 0];
         let v0 : &[Z] = &[];
diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs
index 005a5404b37..1896730285f 100644
--- a/src/librustc/back/rpath.rs
+++ b/src/librustc/back/rpath.rs
@@ -167,7 +167,7 @@ fn get_relative_to(abs1: &Path, abs2: &Path) -> Path {
 
     path.push_all(vec::view(split2, start_idx, len2 - 1));
 
-    if vec::is_not_empty(path) {
+    if !path.is_empty() {
         return Path("").push_many(path);
     } else {
         return Path(".");
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 0633ce4f2e3..79ce755137e 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -1018,8 +1018,8 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: &crate) -> ~[attribute] {
     fn synthesize_link_attr(ecx: @encode_ctxt, +items: ~[@meta_item]) ->
        attribute {
 
-        assert ecx.link_meta.name.is_not_empty();
-        assert ecx.link_meta.vers.is_not_empty();
+        assert !ecx.link_meta.name.is_empty();
+        assert !ecx.link_meta.vers.is_empty();
 
         let name_item =
             attr::mk_name_value_item_str(~"name",
diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs
index 8c9998ee25a..f15817551b6 100644
--- a/src/librustc/metadata/loader.rs
+++ b/src/librustc/metadata/loader.rs
@@ -179,7 +179,7 @@ fn crate_matches(crate_data: @~[u8], +metas: ~[@ast::meta_item],
                  hash: ~str) -> bool {
     let attrs = decoder::get_crate_attributes(crate_data);
     let linkage_metas = attr::find_linkage_metas(attrs);
-    if hash.is_not_empty() {
+    if !hash.is_empty() {
         let chash = decoder::get_crate_hash(crate_data);
         if chash != hash { return false; }
     }
diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs
index 63161a6302e..515666445e3 100644
--- a/src/librustc/middle/lint.rs
+++ b/src/librustc/middle/lint.rs
@@ -820,7 +820,7 @@ fn check_item_path_statement(cx: ty::ctxt, it: @ast::item) {
 fn check_item_non_camel_case_types(cx: ty::ctxt, it: @ast::item) {
     fn is_camel_case(cx: ty::ctxt, ident: ast::ident) -> bool {
         let ident = cx.sess.str_of(ident);
-        assert ident.is_not_empty();
+        assert !ident.is_empty();
         let ident = ident_without_trailing_underscores(ident);
         let ident = ident_without_leading_underscores(ident);
         char::is_uppercase(str::char_at(ident, 0)) &&
diff --git a/src/librustdoc/attr_parser.rs b/src/librustdoc/attr_parser.rs
index aa6e40ab1d1..311245ccc34 100644
--- a/src/librustdoc/attr_parser.rs
+++ b/src/librustdoc/attr_parser.rs
@@ -127,7 +127,7 @@ pub fn parse_hidden(+attrs: ~[ast::attribute]) -> bool {
         match attr::get_meta_item_list(*meta) {
           Some(metas) => {
             let hiddens = attr::find_meta_items_by_name(metas, ~"hidden");
-            vec::is_not_empty(hiddens)
+            !hiddens.is_empty()
           }
           None => false
         }
diff --git a/src/librustdoc/desc_to_brief_pass.rs b/src/librustdoc/desc_to_brief_pass.rs
index 4074d9aa691..f53e0058b63 100644
--- a/src/librustdoc/desc_to_brief_pass.rs
+++ b/src/librustdoc/desc_to_brief_pass.rs
@@ -143,7 +143,7 @@ fn parse_desc(desc: ~str) -> Option<~str> {
 
 fn first_sentence(s: ~str) -> Option<~str> {
     let paras = paragraphs(s);
-    if vec::is_not_empty(paras) {
+    if !paras.is_empty() {
         let first_para = vec::head(paras);
         Some(str::replace(first_sentence_(first_para), ~"\n", ~" "))
     } else {
@@ -193,7 +193,7 @@ fn paragraphs(s: ~str) -> ~[~str] {
             whitespace_lines += 1;
         } else {
             if whitespace_lines > 0 {
-                if str::is_not_empty(accum) {
+                if !accum.is_empty() {
                     res += ~[accum];
                     accum = ~"";
                 }
@@ -211,7 +211,7 @@ fn paragraphs(s: ~str) -> ~[~str] {
         res
     };
 
-    if str::is_not_empty(accum) {
+    if !accum.is_empty() {
         paras + ~[accum]
     } else {
         paras
diff --git a/src/librustdoc/unindent_pass.rs b/src/librustdoc/unindent_pass.rs
index 87c249a7a18..d97dae1bbb6 100644
--- a/src/librustdoc/unindent_pass.rs
+++ b/src/librustdoc/unindent_pass.rs
@@ -78,7 +78,7 @@ fn unindent(s: ~str) -> ~str {
         }
     };
 
-    if vec::is_not_empty(lines) {
+    if !lines.is_empty() {
         let unindented = ~[str::trim(vec::head(lines))]
             + do par::map(vec::tail(lines)) |line| {
             if str::is_whitespace(*line) {
diff --git a/src/libstd/list.rs b/src/libstd/list.rs
index 2d9c96b28a9..0aee29932c5 100644
--- a/src/libstd/list.rs
+++ b/src/libstd/list.rs
@@ -83,11 +83,6 @@ pub pure fn is_empty<T: Copy>(ls: @List<T>) -> bool {
     }
 }
 
-/// Returns true if the list is not empty
-pub pure fn is_not_empty<T: Copy>(ls: @List<T>) -> bool {
-    return !is_empty(ls);
-}
-
 /// Returns the length of a list
 pub pure fn len<T>(ls: @List<T>) -> uint {
     let mut count = 0u;
@@ -177,10 +172,6 @@ mod tests {
         assert is_empty(empty);
         assert !is_empty(full1);
         assert !is_empty(full2);
-
-        assert !is_not_empty(empty);
-        assert is_not_empty(full1);
-        assert is_not_empty(full2);
     }
 
     #[test]
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 56fe46251e9..ed52fbd0f5a 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -245,7 +245,7 @@ fn contains_name(metas: &[@ast::meta_item], name: &str) -> bool {
 }
 
 fn attrs_contains_name(attrs: &[ast::attribute], name: &str) -> bool {
-    vec::is_not_empty(find_attrs_by_name(attrs, name))
+    !find_attrs_by_name(attrs, name).is_empty()
 }
 
 fn first_attr_value_str_by_name(attrs: ~[ast::attribute], name: ~str)
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index c00b956f553..6112313cf48 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -192,7 +192,7 @@ fn diagnosticcolor(lvl: level) -> u8 {
 fn print_diagnostic(topic: ~str, lvl: level, msg: &str) {
     let use_color = term::color_supported() &&
         io::stderr().get_type() == io::Screen;
-    if str::is_not_empty(topic) {
+    if !topic.is_empty() {
         io::stderr().write_str(fmt!("%s ", topic));
     }
     if use_color {
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 7183b623ef4..0bd08250617 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2237,7 +2237,7 @@ impl Parser {
 
         fn check_expected_item(p: Parser, current_attrs: ~[attribute]) {
             // If we have attributes then we should have an item
-            if vec::is_not_empty(current_attrs) {
+            if !current_attrs.is_empty() {
                 p.fatal(~"expected item after attrs");
             }
         }
diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs
index 620bd049053..ae0af82057f 100644
--- a/src/test/run-pass/non-boolean-pure-fns.rs
+++ b/src/test/run-pass/non-boolean-pure-fns.rs
@@ -23,7 +23,7 @@ pure fn pure_length<T: Copy>(ls: @List<T>) -> uint { pure_length_go(ls, 0u) }
 pure fn nonempty_list<T: Copy>(ls: @List<T>) -> bool { pure_length(ls) > 0u }
 
 fn safe_head<T: Copy>(ls: @List<T>) -> T {
-    assert is_not_empty(ls);
+    assert !is_empty(ls);
     return head(ls);
 }
 
diff --git a/src/test/run-pass/zip-same-length.rs b/src/test/run-pass/zip-same-length.rs
index c5a3c8baa3d..62b6ebf20ae 100644
--- a/src/test/run-pass/zip-same-length.rs
+++ b/src/test/run-pass/zip-same-length.rs
@@ -10,7 +10,7 @@
 
 // In this case, the code should compile and should
 // succeed at runtime
-use vec::{head, is_not_empty, last, same_length, zip};
+use vec::{head, last, same_length, zip};
 
 fn enum_chars(start: u8, end: u8) -> ~[char] {
     assert start < end;