Rollup merge of #124624 - WaffleLapkin:old_unit, r=fmease
Use `tcx.types.unit` instead of `Ty::new_unit(tcx)` I don't think there is any need for the function, given that we can just access the `.types`, similarly to all other primitives?
This commit is contained in:
commit
d6940fb43d
20 changed files with 51 additions and 57 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