about summary refs log tree commit diff
path: root/src/libcore
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/libcore
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/libcore')
-rw-r--r--src/libcore/alloc.rs4
-rw-r--r--src/libcore/str/lossy.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs
index 487f3b76fc7..5d0333d5226 100644
--- a/src/libcore/alloc.rs
+++ b/src/libcore/alloc.rs
@@ -827,11 +827,11 @@ pub unsafe trait Alloc {
         let old_size = layout.size();
 
         if new_size >= old_size {
-            if let Ok(()) = self.grow_in_place(ptr, layout.clone(), new_size) {
+            if let Ok(()) = self.grow_in_place(ptr, layout, new_size) {
                 return Ok(ptr);
             }
         } else if new_size < old_size {
-            if let Ok(()) = self.shrink_in_place(ptr, layout.clone(), new_size) {
+            if let Ok(()) = self.shrink_in_place(ptr, layout, new_size) {
                 return Ok(ptr);
             }
         }
diff --git a/src/libcore/str/lossy.rs b/src/libcore/str/lossy.rs
index b291579553a..e8f747f1a67 100644
--- a/src/libcore/str/lossy.rs
+++ b/src/libcore/str/lossy.rs
@@ -46,7 +46,7 @@ impl<'a> Iterator for Utf8LossyChunksIter<'a> {
     type Item = Utf8LossyChunk<'a>;
 
     fn next(&mut self) -> Option<Utf8LossyChunk<'a>> {
-        if self.source.len() == 0 {
+        if self.source.is_empty() {
             return None;
         }
 
@@ -141,7 +141,7 @@ impl fmt::Display for Utf8Lossy {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         // If we're the empty string then our iterator won't actually yield
         // anything, so perform the formatting manually
-        if self.bytes.len() == 0 {
+        if self.bytes.is_empty() {
             return "".fmt(f)
         }