about summary refs log tree commit diff
path: root/src/libcore/slice/mod.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2020-02-28 14:20:33 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2020-02-28 15:16:27 +0100
commit9523c89f18ca62c992e580fc33fe1bf092696d8d (patch)
treefe98aa841d6ff82631ffc933c6f632f16e96546f /src/libcore/slice/mod.rs
parente2223c94bf433fc38234d1303e88cbaf14755863 (diff)
downloadrust-9523c89f18ca62c992e580fc33fe1bf092696d8d.tar.gz
rust-9523c89f18ca62c992e580fc33fe1bf092696d8d.zip
use is_empty() instead of len() == x to determine if structs are empty.
Diffstat (limited to 'src/libcore/slice/mod.rs')
-rw-r--r--src/libcore/slice/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs
index 7c65f595790..9a4561f2869 100644
--- a/src/libcore/slice/mod.rs
+++ b/src/libcore/slice/mod.rs
@@ -3823,7 +3823,7 @@ where
         // The last index of self.v is already checked and found to match
         // by the last iteration, so we start searching a new match
         // one index to the left.
-        let remainder = if self.v.len() == 0 { &[] } else { &self.v[..(self.v.len() - 1)] };
+        let remainder = if self.v.is_empty() { &[] } else { &self.v[..(self.v.len() - 1)] };
         let idx = remainder.iter().rposition(|x| (self.pred)(x)).map(|idx| idx + 1).unwrap_or(0);
         if idx == 0 {
             self.finished = true;
@@ -4033,7 +4033,7 @@ where
             return None;
         }
 
-        let idx_opt = if self.v.len() == 0 {
+        let idx_opt = if self.v.is_empty() {
             None
         } else {
             // work around borrowck limitations