Skip to content

Commit bc3c98f

Browse files
committed
Use is_empty
We already use is_empty in other places, so it is presumably consistent with these.
1 parent bae1512 commit bc3c98f

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/adaptors/multi_product.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<I> Iterator for MultiProduct<I>
161161
}
162162

163163
fn count(self) -> usize {
164-
if self.0.len() == 0 {
164+
if self.0.is_empty() {
165165
return 0;
166166
}
167167

@@ -183,7 +183,7 @@ impl<I> Iterator for MultiProduct<I>
183183

184184
fn size_hint(&self) -> (usize, Option<usize>) {
185185
// Not ExactSizeIterator because size may be larger than usize
186-
if self.0.len() == 0 {
186+
if self.0.is_empty() {
187187
return (0, Some(0));
188188
}
189189

src/combinations.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<I> Iterator for Combinations<I>
5656
return None;
5757
}
5858
self.first = false;
59-
} else if self.indices.len() == 0 {
59+
} else if self.indices.is_empty() {
6060
return None;
6161
} else {
6262
// Scan from the end, looking for an index to increment

src/format.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<'a, I, F> fmt::Display for FormatWith<'a, I, F>
6060
if let Some(fst) = iter.next() {
6161
format(fst, &mut |disp: &dyn fmt::Display| disp.fmt(f))?;
6262
for elt in iter {
63-
if self.sep.len() > 0 {
63+
if !self.sep.is_empty() {
6464

6565
f.write_str(self.sep)?;
6666
}
@@ -85,7 +85,7 @@ impl<'a, I> Format<'a, I>
8585
if let Some(fst) = iter.next() {
8686
cb(&fst, f)?;
8787
for elt in iter {
88-
if self.sep.len() > 0 {
88+
if !self.sep.is_empty() {
8989
f.write_str(self.sep)?;
9090
}
9191
cb(&elt, f)?;

src/tuple_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<T> Iterator for TupleBuffer<T>
5757

5858
fn size_hint(&self) -> (usize, Option<usize>) {
5959
let buffer = &self.buf.as_ref()[self.cur..];
60-
let len = if buffer.len() == 0 {
60+
let len = if buffer.is_empty() {
6161
0
6262
} else {
6363
buffer.iter()

0 commit comments

Comments
 (0)