diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index fcadcb544c431..70262361211b9 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -721,6 +721,7 @@ impl BinaryHeap { /// /// assert_eq!(heap.len(), 2); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn len(&self) -> usize { self.data.len() @@ -744,6 +745,7 @@ impl BinaryHeap { /// /// assert!(!heap.is_empty()); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn is_empty(&self) -> bool { self.len() == 0 diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index 49e488702b4b9..a0aabbfe8bcd5 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -2074,6 +2074,7 @@ impl BTreeMap { /// a.insert(1, "a"); /// assert_eq!(a.len(), 1); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn len(&self) -> usize { self.length @@ -2093,6 +2094,7 @@ impl BTreeMap { /// a.insert(1, "a"); /// assert!(!a.is_empty()); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn is_empty(&self) -> bool { self.len() == 0 diff --git a/src/liballoc/collections/btree/set.rs b/src/liballoc/collections/btree/set.rs index af9a7074e4a4f..7540e4600548c 100644 --- a/src/liballoc/collections/btree/set.rs +++ b/src/liballoc/collections/btree/set.rs @@ -729,6 +729,7 @@ impl BTreeSet { /// v.insert(1); /// assert_eq!(v.len(), 1); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn len(&self) -> usize { self.map.len() @@ -746,6 +747,7 @@ impl BTreeSet { /// v.insert(1); /// assert!(!v.is_empty()); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn is_empty(&self) -> bool { self.len() == 0 diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs index cbf104a8fcde9..651a059dfa193 100644 --- a/src/liballoc/collections/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -932,6 +932,7 @@ impl VecDeque { /// v.push_front(1); /// assert!(!v.is_empty()); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn is_empty(&self) -> bool { self.tail == self.head diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index f7a0bbdceafc9..88b7aa827e378 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1180,6 +1180,7 @@ impl Vec { /// v.push(1); /// assert!(!v.is_empty()); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn is_empty(&self) -> bool { self.len() == 0 diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 349aa029ba8cb..03d4137486ebb 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1215,6 +1215,7 @@ impl HashMap /// a.insert(1, "a"); /// assert_eq!(a.len(), 1); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn len(&self) -> usize { self.table.size() diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 5ac3e8f9cf7d3..1de3dc5b8f394 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -461,6 +461,7 @@ impl HashSet /// v.insert(1); /// assert_eq!(v.len(), 1); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn len(&self) -> usize { self.map.len() @@ -478,6 +479,7 @@ impl HashSet /// v.insert(1); /// assert!(!v.is_empty()); /// ``` + #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn is_empty(&self) -> bool { self.map.is_empty() diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 479e6dccb90dd..c40caee93b1dd 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -776,6 +776,7 @@ impl RawTable { /// The number of elements ever `put` in the hashtable, minus the number /// of elements ever `take`n. + #[inline] pub fn size(&self) -> usize { self.size }