Skip to content

Commit 7eb8642

Browse files
committed
drop is_not_empty from TreeSet/TreeMap
1 parent 14d7213 commit 7eb8642

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/libstd/treemap.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ impl <K: Ord, V> TreeMap<K, V> {
120120
/// Create an empty TreeMap
121121
static pure fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
122122

123-
/// Return true if the map contains some elements
124-
pure fn is_not_empty(&self) -> bool { self.root.is_some() }
125123

126124
/// Visit all key-value pairs in reverse order
127125
pure fn each_reverse(&self, f: fn(&K, &V) -> bool) {
@@ -176,7 +174,7 @@ impl <K: Ord, V> TreeMapIterator<K, V> {
176174
/// tuple with a reference to the key and value. If there are no
177175
/// more nodes, return `None`.
178176
fn next(&mut self) -> Option<(&self/K, &self/V)> {
179-
while self.stack.is_not_empty() || self.node.is_some() {
177+
while !self.stack.is_empty() || self.node.is_some() {
180178
match *self.node {
181179
Some(ref x) => {
182180
self.stack.push(x);
@@ -240,9 +238,6 @@ impl <T: Ord> TreeSet<T> {
240238
/// Create an empty TreeSet
241239
static pure fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} }
242240

243-
/// Return true if the set contains some elements
244-
pure fn is_not_empty(&self) -> bool { self.map.is_not_empty() }
245-
246241
/// Visit all values in reverse order
247242
pure fn each_reverse(&self, f: fn(&T) -> bool) {
248243
self.map.each_key_reverse(f)
@@ -675,7 +670,6 @@ mod test_treemap {
675670

676671
fn check_equal<K: Eq Ord, V: Eq>(ctrl: &[(K, V)], map: &TreeMap<K, V>) {
677672
assert ctrl.is_empty() == map.is_empty();
678-
assert ctrl.is_not_empty() == map.is_not_empty();
679673
for ctrl.each |x| {
680674
let &(k, v) = x;
681675
assert map.find(&k).unwrap() == &v

0 commit comments

Comments
 (0)