Skip to content

Commit

Permalink
examples: Use Display impl for Duration
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Nov 13, 2024
1 parent 5e4dfba commit b178970
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ fn main() {

let now = Instant::now();
let dict = Dictionary::new(EN_US_AFF, EN_US_DIC).unwrap();
println!("Compiled the dictionary in {}ms", now.elapsed().as_millis());
println!("Compiled the dictionary in {:?}", now.elapsed());

let mut suggestions = Vec::with_capacity(5);
let now = Instant::now();
dict.suggest(&word, &mut suggestions);
let time = now.elapsed().as_micros();
let time = now.elapsed();
if suggestions.is_empty() {
println!("No suggestions found for \"{word}\" (checked in {time}µs)");
println!("No suggestions found for \"{word}\" (checked in {time:?})");
} else {
let suggestions = suggestions
.into_iter()
Expand All @@ -50,6 +50,6 @@ fn main() {
s.push('"');
s
});
println!("Suggestions for \"{word}\": {suggestions} (checked in {time}µs)");
println!("Suggestions for \"{word}\": {suggestions} (checked in {time:?})");
}
}

0 comments on commit b178970

Please sign in to comment.