Don't lint unit args if expression kind is path
This commit is contained in:
parent
eb476c6c70
commit
9fe9d94abd
5 changed files with 19 additions and 96 deletions
|
|
@ -955,16 +955,10 @@ impl<'tcx> LateLintPass<'tcx> for UnitArg {
|
|||
.iter()
|
||||
.filter(|arg| {
|
||||
if is_unit(cx.typeck_results().expr_ty(arg)) && !is_unit_literal(arg) {
|
||||
match &arg.kind {
|
||||
ExprKind::Block(..)
|
||||
| ExprKind::Call(..)
|
||||
| ExprKind::If(..)
|
||||
| ExprKind::MethodCall(..) => true,
|
||||
ExprKind::Match(..) => {
|
||||
!matches!(&arg.kind, ExprKind::Match(.., MatchSource::TryDesugar))
|
||||
},
|
||||
_ => false,
|
||||
}
|
||||
!matches!(
|
||||
&arg.kind,
|
||||
ExprKind::Match(.., MatchSource::TryDesugar) | ExprKind::Path(..)
|
||||
)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue