Skip to content

Commit

Permalink
fix some more clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
hellow554 committed Jul 7, 2022
1 parent bc52825 commit 986992a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
3 changes: 1 addition & 2 deletions src/flatten_ok.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ where
let inner_hint = |inner: &Option<T::IntoIter>| {
inner
.as_ref()
.map(Iterator::size_hint)
.unwrap_or((0, Some(0)))
.map_or((0, Some(0)), Iterator::size_hint)
};
let inner_front = inner_hint(&self.inner_front);
let inner_back = inner_hint(&self.inner_back);
Expand Down
20 changes: 8 additions & 12 deletions src/lazy_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,12 @@ where
if self.done {
return false;
}
let next_item = self.it.next();
match next_item {
Some(x) => {
self.buffer.push(x);
true
}
None => {
self.done = true;
false
}
if let Some(x) = self.it.next() {
self.buffer.push(x);
true
} else {
self.done = true;
false
}
}

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

fn index(&self, _index: J) -> &Self::Output {
self.buffer.index(_index)
fn index(&self, index: J) -> &Self::Output {
self.buffer.index(index)
}
}
7 changes: 2 additions & 5 deletions src/permutations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,15 @@ where

Some(indices.map(|i| vals[i].clone()).collect())
}
PermutationState::Complete(CompleteState::Start { .. }) => None,
PermutationState::Complete(CompleteState::Ongoing { ref indices, ref cycles }) => {
let k = cycles.len();

Some(indices[0..k].iter().map(|&i| vals[i].clone()).collect())
},
PermutationState::Empty => None
PermutationState::Complete(CompleteState::Start { .. }) | PermutationState::Empty => None
}
}

fn count(self) -> usize {
let Permutations { vals, state } = self;

fn from_complete(complete_state: CompleteState) -> usize {
match complete_state.remaining() {
CompleteStateRemaining::Known(count) => count,
Expand All @@ -135,6 +131,7 @@ where
}
}

let Permutations { vals, state } = self;
match state {
PermutationState::StartUnknownLen { k } => {
let n = vals.len() + vals.it.count();
Expand Down
2 changes: 1 addition & 1 deletion src/tuple_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ pub fn tuple_windows<I, T>(mut iter: I) -> TupleWindows<I, T>
}

TupleWindows {
last,
iter,
last,
}
}

Expand Down

0 comments on commit 986992a

Please sign in to comment.