Add higher docs and remove some unneeded fields

This commit is contained in:
Cameron Steffen
2021-08-27 08:38:07 -05:00
committed by flip1995
parent c7c2036cb9
commit c2bb313e7a
3 changed files with 65 additions and 49 deletions

View File

@@ -580,8 +580,8 @@ impl<'tcx> LateLintPass<'tcx> for Loops {
while_let_on_iterator::check(cx, expr);
if let Some(higher::While { if_cond, if_then, .. }) = higher::While::hir(expr) {
while_immutable_condition::check(cx, if_cond, if_then);
if let Some(higher::While { condition, body }) = higher::While::hir(expr) {
while_immutable_condition::check(cx, condition, body);
}
needless_collect::check(expr, cx);

View File

@@ -14,12 +14,7 @@ use rustc_span::{symbol::sym, Span, Symbol};
pub(super) fn check(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
let (scrutinee_expr, iter_expr, some_pat, loop_expr) = if_chain! {
if let Some(higher::WhileLet {
if_then,
let_pat,
let_expr,
..
}) = higher::WhileLet::hir(expr);
if let Some(higher::WhileLet { if_then, let_pat, let_expr }) = higher::WhileLet::hir(expr);
// check for `Some(..)` pattern
if let PatKind::TupleStruct(QPath::Resolved(None, pat_path), some_pat, _) = let_pat.kind;
if let Res::Def(_, pat_did) = pat_path.res;