mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Rollup merge of #5341 - flip1995:rustup, r=flip1995
Rustup to rust-lang/rust#66131 changelog: none
This commit is contained in:
commit
606e3285b2
9 changed files with 14 additions and 14 deletions
|
@ -486,7 +486,7 @@ fn is_mutable_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, tys: &mut FxHash
|
|||
if let hir::PatKind::Wild = pat.kind {
|
||||
return false; // ignore `_` patterns
|
||||
}
|
||||
let def_id = pat.hir_id.owner_def_id();
|
||||
let def_id = pat.hir_id.owner.to_def_id();
|
||||
if cx.tcx.has_typeck_tables(def_id) {
|
||||
is_mutable_ty(cx, &cx.tcx.typeck_tables_of(def_id).pat_ty(pat), pat.span, tys)
|
||||
} else {
|
||||
|
@ -601,7 +601,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
|
|||
Call(_, args) | MethodCall(_, _, args) => {
|
||||
let mut tys = FxHashSet::default();
|
||||
for arg in args {
|
||||
let def_id = arg.hir_id.owner_def_id();
|
||||
let def_id = arg.hir_id.owner.to_def_id();
|
||||
if self.cx.tcx.has_typeck_tables(def_id)
|
||||
&& is_mutable_ty(
|
||||
self.cx,
|
||||
|
|
|
@ -59,7 +59,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
|
|||
// but filter out implementations that have generic params (type or lifetime)
|
||||
// or are derived from a macro
|
||||
if !in_macro(item.span) && generics.params.is_empty() {
|
||||
self.impls.insert(item.hir_id.owner_def_id(), item.span);
|
||||
self.impls.insert(item.hir_id.owner.to_def_id(), item.span);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
|
|||
// Retrieve all inherent implementations from the crate, grouped by type
|
||||
for impls in cx
|
||||
.tcx
|
||||
.crate_inherent_impls(item.hir_id.owner_def_id().krate)
|
||||
.crate_inherent_impls(item.hir_id.owner.to_def_id().krate)
|
||||
.inherent_impls
|
||||
.values()
|
||||
{
|
||||
|
|
|
@ -1679,7 +1679,7 @@ fn check_for_mutation(
|
|||
span_low: None,
|
||||
span_high: None,
|
||||
};
|
||||
let def_id = def_id::DefId::local(body.hir_id.owner);
|
||||
let def_id = body.hir_id.owner.to_def_id();
|
||||
cx.tcx.infer_ctxt().enter(|infcx| {
|
||||
ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(body);
|
||||
});
|
||||
|
|
|
@ -135,7 +135,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
|||
hir::ItemKind::Fn(..) => {
|
||||
// ignore main()
|
||||
if it.ident.name == sym!(main) {
|
||||
let def_id = cx.tcx.hir().local_def_id(it.hir_id);
|
||||
let def_id = it.hir_id.owner;
|
||||
let def_key = cx.tcx.hir().def_key(def_id);
|
||||
if def_key.parent == Some(hir::def_id::CRATE_DEF_INDEX) {
|
||||
return;
|
||||
|
|
|
@ -149,9 +149,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
|
|||
if_chain! {
|
||||
if let Some(ref impling_types) = self.impling_types;
|
||||
if let Some(self_def) = cx.tcx.type_of(self_did).ty_adt_def();
|
||||
if self_def.did.is_local();
|
||||
if let Some(self_def_id) = self_def.did.as_local();
|
||||
then {
|
||||
let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_def.did.to_local());
|
||||
let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_def_id);
|
||||
if impling_types.contains(&self_id) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ fn check_manual_swap(cx: &LateContext<'_, '_>, block: &Block<'_>) {
|
|||
then {
|
||||
if let ExprKind::Field(ref lhs1, _) = lhs1.kind {
|
||||
if let ExprKind::Field(ref lhs2, _) = lhs2.kind {
|
||||
if lhs1.hir_id.owner_def_id() == lhs2.hir_id.owner_def_id() {
|
||||
if lhs1.hir_id.owner == lhs2.hir_id.owner {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,8 +297,8 @@ pub fn qpath_res(cx: &LateContext<'_, '_>, qpath: &hir::QPath<'_>, id: hir::HirI
|
|||
match qpath {
|
||||
hir::QPath::Resolved(_, path) => path.res,
|
||||
hir::QPath::TypeRelative(..) => {
|
||||
if cx.tcx.has_typeck_tables(id.owner_def_id()) {
|
||||
cx.tcx.typeck_tables_of(id.owner_def_id()).qpath_res(qpath, id)
|
||||
if cx.tcx.has_typeck_tables(id.owner.to_def_id()) {
|
||||
cx.tcx.typeck_tables_of(id.owner.to_def_id()).qpath_res(qpath, id)
|
||||
} else {
|
||||
Res::Err
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ use rustc_ast::ast;
|
|||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use rustc_hir::{def_id, Expr, HirId, Path};
|
||||
use rustc_hir::{Expr, HirId, Path};
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_span::symbol::Ident;
|
||||
|
@ -17,7 +17,7 @@ pub fn mutated_variables<'a, 'tcx>(expr: &'tcx Expr<'_>, cx: &'a LateContext<'a,
|
|||
used_mutably: FxHashSet::default(),
|
||||
skip: false,
|
||||
};
|
||||
let def_id = def_id::DefId::local(expr.hir_id.owner);
|
||||
let def_id = expr.hir_id.owner.to_def_id();
|
||||
cx.tcx.infer_ctxt().enter(|infcx| {
|
||||
ExprUseVisitor::new(&mut delegate, &infcx, def_id, cx.param_env, cx.tables).walk_expr(expr);
|
||||
});
|
||||
|
|
|
@ -85,7 +85,7 @@ impl LateLintPass<'_, '_> for WildcardImports {
|
|||
if let ItemKind::Use(use_path, UseKind::Glob) = &item.kind;
|
||||
// don't lint prelude glob imports
|
||||
if !use_path.segments.iter().last().map_or(false, |ps| ps.ident.as_str() == "prelude");
|
||||
let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner_def_id());
|
||||
let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner.to_def_id());
|
||||
if !used_imports.is_empty(); // Already handled by `unused_imports`
|
||||
then {
|
||||
let mut applicability = Applicability::MachineApplicable;
|
||||
|
|
Loading…
Reference in a new issue