about summary refs log tree commit diff
path: root/src/liballoc/collections
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-07-28 11:11:08 +0200
committerGitHub <noreply@github.com>2019-07-28 11:11:08 +0200
commitb405aa2d0301c5fc448299501278ae2db4e15e50 (patch)
tree25f749e1f7d4c446983d7e3dd9b16eb0bf4b8dab /src/liballoc/collections
parent2826bdcfa6fecc656294534162fb5990d3d53cf5 (diff)
parent124f6ef7cdea1083b0cbe0371e3f7fbe1152a9d1 (diff)
downloadrust-b405aa2d0301c5fc448299501278ae2db4e15e50.tar.gz
rust-b405aa2d0301c5fc448299501278ae2db4e15e50.zip
Rollup merge of #62806 - mati865:clippy, r=TimNN
Fix few Clippy warnings
Diffstat (limited to 'src/liballoc/collections')
-rw-r--r--src/liballoc/collections/btree/map.rs6
-rw-r--r--src/liballoc/collections/linked_list.rs8
2 files changed, 7 insertions, 7 deletions
diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs
index 7cf779b3e72..1683b810556 100644
--- a/src/liballoc/collections/btree/map.rs
+++ b/src/liballoc/collections/btree/map.rs
@@ -200,7 +200,7 @@ impl<K: Clone, V: Clone> Clone for BTreeMap<K, V> {
             }
         }
 
-        if self.len() == 0 {
+        if self.is_empty() {
             // Ideally we'd call `BTreeMap::new` here, but that has the `K:
             // Ord` constraint, which this method lacks.
             BTreeMap {
@@ -759,12 +759,12 @@ impl<K: Ord, V> BTreeMap<K, V> {
     #[stable(feature = "btree_append", since = "1.11.0")]
     pub fn append(&mut self, other: &mut Self) {
         // Do we have to append anything at all?
-        if other.len() == 0 {
+        if other.is_empty() {
             return;
         }
 
         // We can just swap `self` and `other` if `self` is empty.
-        if self.len() == 0 {
+        if self.is_empty() {
             mem::swap(self, other);
             return;
         }
diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs
index db0d6e2f9b9..bbb96725ea0 100644
--- a/src/liballoc/collections/linked_list.rs
+++ b/src/liballoc/collections/linked_list.rs
@@ -237,15 +237,15 @@ impl<T> LinkedList<T> {
 
         // Not creating new mutable (unique!) references overlapping `element`.
         match node.prev {
-            Some(prev) => (*prev.as_ptr()).next = node.next.clone(),
+            Some(prev) => (*prev.as_ptr()).next = node.next,
             // this node is the head node
-            None => self.head = node.next.clone(),
+            None => self.head = node.next,
         };
 
         match node.next {
-            Some(next) => (*next.as_ptr()).prev = node.prev.clone(),
+            Some(next) => (*next.as_ptr()).prev = node.prev,
             // this node is the tail node
-            None => self.tail = node.prev.clone(),
+            None => self.tail = node.prev,
         };
 
         self.len -= 1;