Skip to content

Commit 38a2829

Browse files
committed
doc(trait_checking): use is_some_and
1 parent 6b71c16 commit 38a2829

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

book/src/development/trait_checking.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ use rustc_span::symbol::sym;
2424

2525
impl LateLintPass<'_> for CheckIteratorTraitLint {
2626
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
27-
let implements_iterator = cx.tcx.get_diagnostic_item(sym::Iterator).map_or(false, |id| {
28-
implements_trait(cx, cx.typeck_results().expr_ty(expr), id, &[])
29-
});
30-
if implements_iterator {
31-
// [...]
32-
}
27+
let implements_iterator = (cx.tcx.get_diagnostic_item(sym::Iterator))
28+
.is_some_and(|id| implements_trait(cx, cx.typeck_results().expr_ty(expr), id, &[]));
29+
if implements_iterator {
30+
// [...]
31+
}
3332

3433
}
3534
}

0 commit comments

Comments
 (0)