Skip to content

Commit ba6a9d8

Browse files
committed
use while-let
1 parent 0a6d246 commit ba6a9d8

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

clippy_lints/src/useless_conversion.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,11 @@ fn into_iter_call<'hir>(cx: &LateContext<'_>, expr: &'hir Expr<'hir>) -> Option<
9595
/// ^^^ we want this expression
9696
fn into_iter_deep_call<'hir>(cx: &LateContext<'_>, mut expr: &'hir Expr<'hir>) -> Option<(&'hir Expr<'hir>, usize)> {
9797
let mut depth = 0;
98-
loop {
99-
if let Some(recv) = into_iter_call(cx, expr) {
100-
expr = recv;
101-
depth += 1;
102-
} else {
103-
return Some((expr, depth));
104-
}
98+
while let Some(recv) = into_iter_call(cx, expr) {
99+
expr = recv;
100+
depth += 1;
105101
}
102+
Some((expr, depth))
106103
}
107104

108105
#[expect(clippy::too_many_lines)]

0 commit comments

Comments
 (0)