Skip to content

Commit 986992a

Browse files
committed
fix some more clippy lints
1 parent bc52825 commit 986992a

File tree

4 files changed

+12
-20
lines changed

4 files changed

+12
-20
lines changed

src/flatten_ok.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ where
7676
let inner_hint = |inner: &Option<T::IntoIter>| {
7777
inner
7878
.as_ref()
79-
.map(Iterator::size_hint)
80-
.unwrap_or((0, Some(0)))
79+
.map_or((0, Some(0)), Iterator::size_hint)
8180
};
8281
let inner_front = inner_hint(&self.inner_front);
8382
let inner_back = inner_hint(&self.inner_back);

src/lazy_buffer.rs

+8-12
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,12 @@ where
2828
if self.done {
2929
return false;
3030
}
31-
let next_item = self.it.next();
32-
match next_item {
33-
Some(x) => {
34-
self.buffer.push(x);
35-
true
36-
}
37-
None => {
38-
self.done = true;
39-
false
40-
}
31+
if let Some(x) = self.it.next() {
32+
self.buffer.push(x);
33+
true
34+
} else {
35+
self.done = true;
36+
false
4137
}
4238
}
4339

@@ -61,7 +57,7 @@ where
6157
{
6258
type Output = <Vec<I::Item> as Index<J>>::Output;
6359

64-
fn index(&self, _index: J) -> &Self::Output {
65-
self.buffer.index(_index)
60+
fn index(&self, index: J) -> &Self::Output {
61+
self.buffer.index(index)
6662
}
6763
}

src/permutations.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,15 @@ where
113113

114114
Some(indices.map(|i| vals[i].clone()).collect())
115115
}
116-
PermutationState::Complete(CompleteState::Start { .. }) => None,
117116
PermutationState::Complete(CompleteState::Ongoing { ref indices, ref cycles }) => {
118117
let k = cycles.len();
119-
120118
Some(indices[0..k].iter().map(|&i| vals[i].clone()).collect())
121119
},
122-
PermutationState::Empty => None
120+
PermutationState::Complete(CompleteState::Start { .. }) | PermutationState::Empty => None
123121
}
124122
}
125123

126124
fn count(self) -> usize {
127-
let Permutations { vals, state } = self;
128-
129125
fn from_complete(complete_state: CompleteState) -> usize {
130126
match complete_state.remaining() {
131127
CompleteStateRemaining::Known(count) => count,
@@ -135,6 +131,7 @@ where
135131
}
136132
}
137133

134+
let Permutations { vals, state } = self;
138135
match state {
139136
PermutationState::StartUnknownLen { k } => {
140137
let n = vals.len() + vals.it.count();

src/tuple_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ pub fn tuple_windows<I, T>(mut iter: I) -> TupleWindows<I, T>
163163
}
164164

165165
TupleWindows {
166-
last,
167166
iter,
167+
last,
168168
}
169169
}
170170

0 commit comments

Comments
 (0)