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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user