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 authored and phimuemue committed Jul 7, 2022
1 parent ed6fbda commit 412b75b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
20 changes: 8 additions & 12 deletions src/lazy_buffer.rs
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
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
Expand Up @@ -162,8 +162,8 @@ pub fn tuple_windows<I, T>(mut iter: I) -> TupleWindows<I, T>
}

TupleWindows {
last,
iter,
last,
}
}

Expand Down

0 comments on commit 412b75b

Please sign in to comment.