Skip to content

Commit 51d20c4

Browse files
committed
ui: clean up and format
1 parent f36c98d commit 51d20c4

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

src/ui.rs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use ratatui::{
1212
widgets::{Axis, Block, BorderType, Borders, Chart, Dataset, GraphType, Paragraph, Widget},
1313
};
1414
use results::Fraction;
15-
use std::iter;
1615

1716
// Convert CPS to WPM (clicks per second)
1817
const WPM_PER_CPS: f64 = 12.0;
@@ -134,8 +133,6 @@ impl ThemedWidget for &Test {
134133
}
135134
}
136135

137-
138-
139136
fn words_to_spans<'a>(
140137
words: &'a [TestWord],
141138
current_word: usize,
@@ -169,6 +166,7 @@ enum Status {
169166
Untyped,
170167
Overtyped,
171168
}
169+
172170
fn split_current_word(word: &TestWord) -> Vec<(String, Status)> {
173171
let mut parts = Vec::new();
174172
let mut cur_string = String::new();
@@ -250,9 +248,7 @@ fn split_typed_word(word: &TestWord) -> Vec<(String, Status)> {
250248
parts
251249
}
252250

253-
254-
255-
fn word_parts_to_spans<'a>(parts: Vec<(String, Status)>, theme: &'a Theme) -> Vec<Span<'a>> {
251+
fn word_parts_to_spans(parts: Vec<(String, Status)>, theme: &Theme) -> Vec<Span<'_>> {
256252
let mut spans = Vec::new();
257253
for (text, status) in parts {
258254
let style = match status {
@@ -412,17 +408,8 @@ impl ThemedWidget for &results::Results {
412408
}
413409
}
414410

415-
// FIXME: replace with `str::ceil_char_boundary` when stable
416-
fn ceil_char_boundary(string: &str, index: usize) -> usize {
417-
if string.is_char_boundary(index) {
418-
index
419-
} else {
420-
ceil_char_boundary(string, index + 1)
421-
}
422-
}
423-
424411
#[cfg(test)]
425-
mod test_ui {
412+
mod tests {
426413
use super::*;
427414

428415
mod split_words {
@@ -442,7 +429,7 @@ mod test_ui {
442429
let expected = test_case
443430
.expected
444431
.iter()
445-
.map(|(s, v)| (s.to_string(), v.clone()))
432+
.map(|(s, v)| (s.to_string(), *v))
446433
.collect::<Vec<_>>();
447434

448435
(word, expected)

0 commit comments

Comments
 (0)