Inline & delete Ty::new_unit
, since it's just a field access
This commit is contained in:
parent
f92d49b7fe
commit
698d7a031e
19 changed files with 50 additions and 56 deletions
|
@ -1,7 +1,6 @@
|
|||
use crate::lints::UnitBindingsDiag;
|
||||
use crate::{LateLintPass, LintContext};
|
||||
use rustc_hir as hir;
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
|
||||
declare_lint! {
|
||||
|
@ -57,8 +56,8 @@ impl<'tcx> LateLintPass<'tcx> for UnitBindings {
|
|||
&& let Some(init) = local.init
|
||||
&& let init_ty = tyck_results.expr_ty(init)
|
||||
&& let local_ty = tyck_results.node_type(local.hir_id)
|
||||
&& init_ty == Ty::new_unit(cx.tcx)
|
||||
&& local_ty == Ty::new_unit(cx.tcx)
|
||||
&& init_ty == cx.tcx.types.unit
|
||||
&& local_ty == cx.tcx.types.unit
|
||||
&& local.ty.is_none()
|
||||
&& !matches!(init.kind, hir::ExprKind::Tup([]))
|
||||
&& !matches!(local.pat.kind, hir::PatKind::Tuple([], ..))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue