Skip to content

Commit

Permalink
Rollup merge of rust-lang#5341 - flip1995:rustup, r=flip1995
Browse files Browse the repository at this point in the history
Rustup to rust-lang/rust#66131

changelog: none
  • Loading branch information
flip1995 authored Mar 19, 2020
2 parents a46675f + 21aeb21 commit 606e328
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/inherent_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand All @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/missing_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/new_without_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/utils/usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
});
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/wildcard_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 606e328

Please sign in to comment.