Changing implementation of is_empty to something more efficient

This commit is contained in:
Tomasz Drwięga 2016-03-01 00:40:55 +01:00
parent ed6a35f618
commit 816e549d4c

View File

@ -52,7 +52,7 @@ impl<Row, Col, Val> Table<Row, Col, Val>
/// Check if there is any element in this Table /// Check if there is any element in this Table
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
self.len() == 0 self.map.is_empty() || self.map.values().all(|v| v.is_empty())
} }
/// Get mutable reference for single Table row. /// Get mutable reference for single Table row.