mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
rustc: Parameterize ty::Visibility
over used ID
It allows using `LocalDefId` instead of `DefId` when possible, and also encode cheaper `Visibility<DefIndex>` into metadata.
This commit is contained in:
parent
ce339b219a
commit
9136096629
2 changed files with 3 additions and 3 deletions
|
@ -142,7 +142,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
|
|||
if adt.is_struct();
|
||||
let variant = adt.non_enum_variant();
|
||||
if adt.did().is_local() || !variant.is_field_list_non_exhaustive();
|
||||
let module_did = cx.tcx.parent_module(stmt.hir_id).to_def_id();
|
||||
let module_did = cx.tcx.parent_module(stmt.hir_id);
|
||||
if variant
|
||||
.fields
|
||||
.iter()
|
||||
|
|
|
@ -15,7 +15,7 @@ use rustc_middle::hir::nested_filter;
|
|||
use rustc_middle::traits::Reveal;
|
||||
use rustc_middle::ty::{
|
||||
self, Binder, BoundConstness, GenericParamDefKind, ImplPolarity, ParamEnv, PredicateKind, TraitPredicate, TraitRef,
|
||||
Ty, TyCtxt, Visibility,
|
||||
Ty, TyCtxt,
|
||||
};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
use rustc_span::source_map::Span;
|
||||
|
@ -464,7 +464,7 @@ impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
|
|||
fn check_partial_eq_without_eq<'tcx>(cx: &LateContext<'tcx>, span: Span, trait_ref: &hir::TraitRef<'_>, ty: Ty<'tcx>) {
|
||||
if_chain! {
|
||||
if let ty::Adt(adt, substs) = ty.kind();
|
||||
if cx.tcx.visibility(adt.did()) == Visibility::Public;
|
||||
if cx.tcx.visibility(adt.did()).is_public();
|
||||
if let Some(eq_trait_def_id) = cx.tcx.get_diagnostic_item(sym::Eq);
|
||||
if let Some(def_id) = trait_ref.trait_def_id();
|
||||
if cx.tcx.is_diagnostic_item(sym::PartialEq, def_id);
|
||||
|
|
Loading…
Reference in a new issue