kanji_info example: simplify using .inspect()

main
Stefan Majewsky 2 years ago
parent a709995cef
commit e26e3b05cb

@ -6,8 +6,8 @@
fn main() {
let input = "一日";
let count = jmdict::entries()
.filter(|e| {
if e.kanji_elements().any(|k| k.text == input) {
.filter(|e| e.kanji_elements().any(|k| k.text == input))
.inspect(|e| {
// note two entries have identical Kanji
// yet differ in reading
println!("--- entry #{} ---", e.number);
@ -24,10 +24,6 @@ fn main() {
println!("info: {:?}", info);
}
}
return true
}
false
})
.count();
println!("{} entries for {}", count, input);

Loading…
Cancel
Save