Added default impls for container methods

A couple of implementations of Container::is_empty weren't exactly
self.len() == 0 so I left them alone (e.g. Treemap).
This commit is contained in:
Steven Fackler
2013-07-25 04:02:08 -04:00
parent b1f5b1ba5f
commit feb18fe8da
9 changed files with 13 additions and 76 deletions

View File

@@ -1097,24 +1097,16 @@ impl<'self> Container for &'self str {
fn len(&self) -> uint {
do self.as_imm_buf |_p, n| { n - 1u }
}
#[inline]
fn is_empty(&self) -> bool {
self.len() == 0
}
}
impl Container for ~str {
#[inline]
fn len(&self) -> uint { self.as_slice().len() }
#[inline]
fn is_empty(&self) -> bool { self.len() == 0 }
}
impl Container for @str {
#[inline]
fn len(&self) -> uint { self.as_slice().len() }
#[inline]
fn is_empty(&self) -> bool { self.len() == 0 }
}
impl Mutable for ~str {