Skip to content

Commit

Permalink
Merge pull request #55 from Samyak2/clippy-fix
Browse files Browse the repository at this point in the history
chore: clippy
  • Loading branch information
Samyak2 committed Nov 25, 2023
2 parents b5226b7 + 1718019 commit 777de63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl ToipeResults {
/// Uncorrected errors are penalized to encourage correcting errors.
pub fn wpm(&self) -> f64 {
(self.final_chars_typed_correctly as f64 / 5.0 - self.final_uncorrected_errors as f64)
.max(0.0) as f64
.max(0.0)
/ (self.duration().as_secs_f64() / 60.0)
}
}
7 changes: 2 additions & 5 deletions src/textgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl<T: Seek + io::Read> RawWordSelector<T> {
let mut buffer = String::new();

fn is_letter(char: u8) -> bool {
(b'a'..=b'z').contains(&char)
char.is_ascii_lowercase()
}

loop {
Expand Down Expand Up @@ -229,10 +229,7 @@ pub trait WordSelector {

/// Returns a [`Vec`] containing `num_words` words.
fn new_words(&mut self, num_words: usize) -> Result<Vec<String>, io::Error> {
(0..num_words)
.into_iter()
.map(|_| self.new_word())
.collect()
(0..num_words).map(|_| self.new_word()).collect()
}
}

Expand Down

0 comments on commit 777de63

Please sign in to comment.