Skip to content

Commit 9bcc8a4

Browse files
authored
doc(trait_checking): use is_some_and (#15743)
changelog: none
2 parents 6b71c16 + 38a2829 commit 9bcc8a4

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)