diff options
| author | rail <12975677+rail-rain@users.noreply.github.com> | 2020-04-27 20:37:21 +1200 |
|---|---|---|
| committer | rail <12975677+rail-rain@users.noreply.github.com> | 2020-04-27 20:37:21 +1200 |
| commit | 51585a129892f42eb23b0b37fea0e729f6678994 (patch) | |
| tree | 158d0ff2c00d3a6206cb00f676e6ee0067b56030 | |
| parent | be9f7c2b6d99dfb259eec8e9e2f7d9b9685de226 (diff) | |
| download | rust-51585a129892f42eb23b0b37fea0e729f6678994.tar.gz rust-51585a129892f42eb23b0b37fea0e729f6678994.zip | |
Removed unused lifetimes and a needless bool
| -rw-r--r-- | clippy_lints/src/loops.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 7cf3e16bef9..5f7f0897943 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -775,10 +775,9 @@ fn same_var<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &Expr<'_>, var: HirId) - if let QPath::Resolved(None, path) = qpath; if path.segments.len() == 1; if let Res::Local(local_id) = qpath_res(cx, qpath, expr.hir_id); - // our variable! - if local_id == var; then { - true + // our variable! + local_id == var } else { false } @@ -870,10 +869,8 @@ fn get_offset<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, idx: &Expr<'_>, var: HirId) } } -fn get_assignments<'a, 'tcx>( - body: &'tcx Expr<'tcx>, -) -> impl Iterator<Item = Option<(&'tcx Expr<'tcx>, &'tcx Expr<'tcx>)>> { - fn get_assignment<'a, 'tcx>(e: &'tcx Expr<'tcx>) -> Option<(&'tcx Expr<'tcx>, &'tcx Expr<'tcx>)> { +fn get_assignments<'tcx>(body: &'tcx Expr<'tcx>) -> impl Iterator<Item = Option<(&'tcx Expr<'tcx>, &'tcx Expr<'tcx>)>> { + fn get_assignment<'tcx>(e: &'tcx Expr<'tcx>) -> Option<(&'tcx Expr<'tcx>, &'tcx Expr<'tcx>)> { if let ExprKind::Assign(lhs, rhs, _) = e.kind { Some((lhs, rhs)) } else { |
