diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-01-24 23:24:57 -0500 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-01-24 23:24:57 -0500 |
| commit | e4337a9defcad3f2a65da285ab78f8ede554f379 (patch) | |
| tree | 21d2bff727548efa00e3cf7225ab9e43a9d5a2c7 /src/libcore | |
| parent | ec3f6e1932db297d2a575e591d4c508d785a0a52 (diff) | |
| download | rust-e4337a9defcad3f2a65da285ab78f8ede554f379.tar.gz rust-e4337a9defcad3f2a65da285ab78f8ede554f379.zip | |
remove remaining is_not_empty functions/methods
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/dlist.rs | 4 | ||||
| -rw-r--r-- | src/libcore/str.rs | 13 | ||||
| -rw-r--r-- | src/libcore/util.rs | 2 | ||||
| -rw-r--r-- | src/libcore/vec.rs | 11 |
4 files changed, 1 insertions, 29 deletions
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] = &[]; |
