Skip to content

Rustup #11903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Dec 1, 2023
Merged

Rustup #11903

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ toml = "0.7.3"
walkdir = "2.3"
# This is used by the `collect-metadata` alias.
filetime = "0.2"
itertools = "0.10.1"
itertools = "0.11"

# UI test dependencies
clippy_utils = { path = "clippy_utils" }
2 changes: 1 addition & 1 deletion clippy_dev/Cargo.toml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ edition = "2021"
aho-corasick = "0.7"
clap = "4.1.4"
indoc = "1.0"
itertools = "0.10.1"
itertools = "0.11"
opener = "0.5"
shell-escape = "0.1"
walkdir = "2.3"
2 changes: 1 addition & 1 deletion clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ cargo_metadata = "0.15.3"
clippy_config = { path = "../clippy_config" }
clippy_utils = { path = "../clippy_utils" }
declare_clippy_lint = { path = "../declare_clippy_lint" }
itertools = "0.10.1"
itertools = "0.11"
quine-mc_cluskey = "0.2"
regex-syntax = "0.7"
serde = { version = "1.0", features = ["derive"] }
3 changes: 2 additions & 1 deletion clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
@@ -424,8 +424,9 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
improvements.push(suggestion);
}
}
let nonminimal_bool_lint = |suggestions: Vec<_>| {
let nonminimal_bool_lint = |mut suggestions: Vec<_>| {
if self.cx.tcx.lint_level_at_node(NONMINIMAL_BOOL, e.hir_id).0 != Level::Allow {
suggestions.sort();
span_lint_hir_and_then(
self.cx,
NONMINIMAL_BOOL,
2 changes: 1 addition & 1 deletion clippy_lints/src/dereference.rs
Original file line number Diff line number Diff line change
@@ -771,7 +771,7 @@ impl TyCoercionStability {
DefinedTy::Mir(ty) => Self::for_mir_ty(
cx.tcx,
ty.param_env,
cx.tcx.erase_late_bound_regions(ty.value),
cx.tcx.instantiate_bound_regions_with_erased(ty.value),
for_return,
),
}
6 changes: 3 additions & 3 deletions clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
@@ -255,7 +255,7 @@ fn check_hash_peq<'tcx>(
"you are deriving `Hash` but have implemented `PartialEq` explicitly",
|diag| {
if let Some(local_def_id) = impl_id.as_local() {
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
let hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id);
diag.span_note(cx.tcx.hir().span(hir_id), "`PartialEq` implemented here");
}
},
@@ -299,7 +299,7 @@ fn check_ord_partial_ord<'tcx>(

span_lint_and_then(cx, DERIVE_ORD_XOR_PARTIAL_ORD, span, mess, |diag| {
if let Some(local_def_id) = impl_id.as_local() {
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
let hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id);
diag.span_note(cx.tcx.hir().span(hir_id), "`PartialOrd` implemented here");
}
});
@@ -381,7 +381,7 @@ fn check_unsafe_derive_deserialize<'tcx>(
&& match_def_path(cx, trait_def_id, &paths::SERDE_DESERIALIZE)
&& let ty::Adt(def, _) = ty.kind()
&& let Some(local_def_id) = def.did().as_local()
&& let adt_hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id)
&& let adt_hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id)
&& !is_lint_allowed(cx, UNSAFE_DERIVE_DESERIALIZE, adt_hir_id)
&& cx
.tcx
9 changes: 6 additions & 3 deletions clippy_lints/src/equatable_if_let.rs
Original file line number Diff line number Diff line change
@@ -46,9 +46,12 @@ fn unary_pattern(pat: &Pat<'_>) -> bool {
pats.iter().all(unary_pattern)
}
match &pat.kind {
PatKind::Slice(_, _, _) | PatKind::Range(_, _, _) | PatKind::Binding(..) | PatKind::Wild | PatKind::Or(_) => {
false
},
PatKind::Slice(_, _, _)
| PatKind::Range(_, _, _)
| PatKind::Binding(..)
| PatKind::Wild
| PatKind::Never
| PatKind::Or(_) => false,
PatKind::Struct(_, a, etc) => !etc && a.iter().all(|x| unary_pattern(x.pat)),
PatKind::Tuple(a, etc) | PatKind::TupleStruct(_, a, etc) => etc.as_opt_usize().is_none() && array_rec(a),
PatKind::Ref(x, _) | PatKind::Box(x) => unary_pattern(x),
2 changes: 1 addition & 1 deletion clippy_lints/src/error_impl_error.rs
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ impl<'tcx> LateLintPass<'tcx> for ErrorImplError {
if let Some(trait_def_id) = imp.of_trait.and_then(|t| t.trait_def_id())
&& error_def_id == trait_def_id
&& let Some(def_id) = path_res(cx, imp.self_ty).opt_def_id().and_then(DefId::as_local)
&& let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id)
&& let hir_id = cx.tcx.local_def_id_to_hir_id(def_id)
&& let Some(ident) = cx.tcx.opt_item_ident(def_id.to_def_id())
&& ident.name == sym::Error
&& is_visible_outside_module(cx, def_id) =>
2 changes: 1 addition & 1 deletion clippy_lints/src/escape.rs
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
let parent_id = cx
.tcx
.hir()
.get_parent_item(cx.tcx.hir().local_def_id_to_hir_id(fn_def_id))
.get_parent_item(cx.tcx.local_def_id_to_hir_id(fn_def_id))
.def_id;
let parent_node = cx.tcx.hir().find_by_def_id(parent_id);

2 changes: 1 addition & 1 deletion clippy_lints/src/excessive_bools.rs
Original file line number Diff line number Diff line change
@@ -171,7 +171,7 @@ impl<'tcx> LateLintPass<'tcx> for ExcessiveBools {
span: Span,
def_id: LocalDefId,
) {
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
if let Some(fn_header) = fn_kind.header()
&& fn_header.abi == Abi::Rust
&& get_parent_as_impl(cx.tcx, hir_id).map_or(true, |impl_item| impl_item.of_trait.is_none())
8 changes: 4 additions & 4 deletions clippy_lints/src/formatting.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_note};
use clippy_utils::is_span_if;
use clippy_utils::source::snippet_opt;
use rustc_ast::ast::{BinOpKind, Block, Expr, ExprKind, StmtKind, UnOp};
use rustc_ast::ast::{BinOpKind, Block, Expr, ExprKind, StmtKind};
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
use rustc_middle::lint::in_external_macro;
use rustc_session::declare_lint_pass;
@@ -144,7 +144,7 @@ fn check_assign(cx: &EarlyContext<'_>, expr: &Expr) {
let eq_span = lhs.span.between(rhs.span);
if let ExprKind::Unary(op, ref sub_rhs) = rhs.kind {
if let Some(eq_snippet) = snippet_opt(cx, eq_span) {
let op = UnOp::to_string(op);
let op = op.as_str();
let eqop_span = lhs.span.between(sub_rhs.span);
if eq_snippet.ends_with('=') {
span_lint_and_note(
@@ -177,11 +177,11 @@ fn check_unop(cx: &EarlyContext<'_>, expr: &Expr) {
&& let unop_operand_span = rhs.span.until(un_rhs.span)
&& let Some(binop_snippet) = snippet_opt(cx, binop_span)
&& let Some(unop_operand_snippet) = snippet_opt(cx, unop_operand_span)
&& let binop_str = BinOpKind::to_string(&binop.node)
&& let binop_str = binop.node.as_str()
// no space after BinOp operator and space after UnOp operator
&& binop_snippet.ends_with(binop_str) && unop_operand_snippet.ends_with(' ')
{
let unop_str = UnOp::to_string(op);
let unop_str = op.as_str();
let eqop_span = lhs.span.between(un_rhs.span);
span_lint_and_help(
cx,
2 changes: 1 addition & 1 deletion clippy_lints/src/functions/mod.rs
Original file line number Diff line number Diff line change
@@ -407,7 +407,7 @@ impl<'tcx> LateLintPass<'tcx> for Functions {
span: Span,
def_id: LocalDefId,
) {
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
too_many_arguments::check_fn(cx, kind, decl, span, hir_id, self.too_many_arguments_threshold);
too_many_lines::check_fn(cx, kind, span, body, self.too_many_lines_threshold);
not_unsafe_ptr_arg_deref::check_fn(cx, kind, decl, body, def_id);
2 changes: 1 addition & 1 deletion clippy_lints/src/functions/result.rs
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ fn result_err_ty<'tcx>(
&& let hir::FnRetTy::Return(hir_ty) = decl.output
&& let ty = cx
.tcx
.erase_late_bound_regions(cx.tcx.fn_sig(id).instantiate_identity().output())
.instantiate_bound_regions_with_erased(cx.tcx.fn_sig(id).instantiate_identity().output())
&& is_type_diagnostic_item(cx, ty, sym::Result)
&& let ty::Adt(_, args) = ty.kind()
{
2 changes: 1 addition & 1 deletion clippy_lints/src/future_not_send.rs
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
if let FnKind::Closure = kind {
return;
}
let ret_ty = return_ty(cx, cx.tcx.hir().local_def_id_to_hir_id(fn_def_id).expect_owner());
let ret_ty = return_ty(cx, cx.tcx.local_def_id_to_hir_id(fn_def_id).expect_owner());
if let ty::Alias(ty::Opaque, AliasTy { def_id, args, .. }) = *ret_ty.kind() {
let preds = cx.tcx.explicit_item_bounds(def_id);
let mut is_future = false;
4 changes: 2 additions & 2 deletions clippy_lints/src/inherent_impl.rs
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
&& !is_lint_allowed(
cx,
MULTIPLE_INHERENT_IMPL,
cx.tcx.hir().local_def_id_to_hir_id(id),
cx.tcx.local_def_id_to_hir_id(id),
)
}) {
for impl_id in impl_ids.iter().map(|id| id.expect_local()) {
@@ -117,7 +117,7 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {

/// Gets the span for the given impl block unless it's not being considered by the lint.
fn get_impl_span(cx: &LateContext<'_>, id: LocalDefId) -> Option<Span> {
let id = cx.tcx.hir().local_def_id_to_hir_id(id);
let id = cx.tcx.local_def_id_to_hir_id(id);
if let Node::Item(&Item {
kind: ItemKind::Impl(impl_item),
span,
2 changes: 1 addition & 1 deletion clippy_lints/src/iter_not_returning_iterator.rs
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ fn check_sig(cx: &LateContext<'_>, name: &str, sig: &FnSig<'_>, fn_id: LocalDefI
if sig.decl.implicit_self.has_implicit_self() {
let ret_ty = cx
.tcx
.erase_late_bound_regions(cx.tcx.fn_sig(fn_id).instantiate_identity().output());
.instantiate_bound_regions_with_erased(cx.tcx.fn_sig(fn_id).instantiate_identity().output());
let ret_ty = cx
.tcx
.try_normalize_erasing_regions(cx.param_env, ret_ty)
2 changes: 1 addition & 1 deletion clippy_lints/src/len_zero.rs
Original file line number Diff line number Diff line change
@@ -142,7 +142,7 @@ impl<'tcx> LateLintPass<'tcx> for LenZero {
&& let TyKind::Path(ty_path) = &imp.self_ty.kind
&& let Some(ty_id) = cx.qpath_res(ty_path, imp.self_ty.hir_id).opt_def_id()
&& let Some(local_id) = ty_id.as_local()
&& let ty_hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_id)
&& let ty_hir_id = cx.tcx.local_def_id_to_hir_id(local_id)
&& !is_lint_allowed(cx, LEN_WITHOUT_IS_EMPTY, ty_hir_id)
&& let Some(output) =
parse_len_output(cx, cx.tcx.fn_sig(item.owner_id).instantiate_identity().skip_binder())
2 changes: 1 addition & 1 deletion clippy_lints/src/manual_non_exhaustive.rs
Original file line number Diff line number Diff line change
@@ -188,7 +188,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustiveEnum {
.contains(&(enum_id.to_def_id(), variant_id.to_def_id()))
})
{
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(enum_id);
let hir_id = cx.tcx.local_def_id_to_hir_id(enum_id);
span_lint_hir_and_then(
cx,
MANUAL_NON_EXHAUSTIVE,
6 changes: 4 additions & 2 deletions clippy_lints/src/matches/match_same_arms.rs
Original file line number Diff line number Diff line change
@@ -152,6 +152,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) {
#[derive(Clone, Copy)]
enum NormalizedPat<'a> {
Wild,
Never,
Struct(Option<DefId>, &'a [(Symbol, Self)]),
Tuple(Option<DefId>, &'a [Self]),
Or(&'a [Self]),
@@ -223,14 +224,15 @@ fn iter_matching_struct_fields<'a>(
Iter(left.iter(), right.iter())
}

#[expect(clippy::similar_names)]
#[expect(clippy::similar_names, clippy::too_many_lines)]
impl<'a> NormalizedPat<'a> {
fn from_pat(cx: &LateContext<'_>, arena: &'a DroplessArena, pat: &'a Pat<'_>) -> Self {
match pat.kind {
PatKind::Wild | PatKind::Binding(.., None) => Self::Wild,
PatKind::Binding(.., Some(pat)) | PatKind::Box(pat) | PatKind::Ref(pat, _) => {
Self::from_pat(cx, arena, pat)
},
PatKind::Never => Self::Never,
PatKind::Struct(ref path, fields, _) => {
let fields =
arena.alloc_from_iter(fields.iter().map(|f| (f.ident.name, Self::from_pat(cx, arena, f.pat))));
@@ -334,7 +336,7 @@ impl<'a> NormalizedPat<'a> {
/// type.
fn has_overlapping_values(&self, other: &Self) -> bool {
match (*self, *other) {
(Self::Wild, _) | (_, Self::Wild) => true,
(Self::Wild, _) | (_, Self::Wild) | (Self::Never, Self::Never) => true,
(Self::Or(pats), ref other) | (ref other, Self::Or(pats)) => {
pats.iter().any(|pat| pat.has_overlapping_values(other))
},
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/clone_on_copy.rs
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ pub(super) fn check(
// ? is a Call, makes sure not to rec *x?, but rather (*x)?
ExprKind::Call(hir_callee, _) => matches!(
hir_callee.kind,
ExprKind::Path(QPath::LangItem(rustc_hir::LangItem::TryTraitBranch, _, _))
ExprKind::Path(QPath::LangItem(rustc_hir::LangItem::TryTraitBranch, ..))
),
ExprKind::MethodCall(_, self_arg, ..) if expr.hir_id == self_arg.hir_id => true,
ExprKind::Match(_, _, MatchSource::TryDesugar(_) | MatchSource::AwaitDesugar)
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/filter_map_bool_then.rs
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, arg: &
closure.def_id.to_def_id(),
Binder::bind_with_vars(
cx.typeck_results().node_type(param_ty.hir_id),
cx.tcx.late_bound_vars(cx.tcx.hir().local_def_id_to_hir_id(closure.def_id)),
cx.tcx.late_bound_vars(cx.tcx.local_def_id_to_hir_id(closure.def_id)),
),
)
&& is_copy(cx, param_ty)
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/map_flatten.rs
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ fn is_map_to_option(cx: &LateContext<'_>, map_arg: &Expr<'_>) -> bool {
ty::Closure(_, args) => args.as_closure().sig(),
_ => map_closure_ty.fn_sig(cx.tcx),
};
let map_closure_return_ty = cx.tcx.erase_late_bound_regions(map_closure_sig.output());
let map_closure_return_ty = cx.tcx.instantiate_bound_regions_with_erased(map_closure_sig.output());
is_type_diagnostic_item(cx, map_closure_return_ty, sym::Option)
},
_ => false,
2 changes: 1 addition & 1 deletion clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
@@ -3969,7 +3969,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
let implements_trait = matches!(item.kind, hir::ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }));
if let hir::ImplItemKind::Fn(ref sig, id) = impl_item.kind {
let method_sig = cx.tcx.fn_sig(impl_item.owner_id).instantiate_identity();
let method_sig = cx.tcx.erase_late_bound_regions(method_sig);
let method_sig = cx.tcx.instantiate_bound_regions_with_erased(method_sig);
let first_arg_ty_opt = method_sig.inputs().iter().next().copied();
// if this impl block implements a trait, lint in trait definition instead
if !implements_trait && cx.effective_visibilities.is_exported(impl_item.owner_id.def_id) {
5 changes: 4 additions & 1 deletion clippy_lints/src/methods/needless_collect.rs
Original file line number Diff line number Diff line change
@@ -225,7 +225,10 @@ fn is_contains_sig(cx: &LateContext<'_>, call_id: HirId, iter_expr: &Expr<'_>) -
&& let sig = cx.tcx.fn_sig(id).instantiate_identity()
&& sig.skip_binder().output().is_bool()
&& let [_, search_ty] = *sig.skip_binder().inputs()
&& let ty::Ref(_, search_ty, Mutability::Not) = *cx.tcx.erase_late_bound_regions(sig.rebind(search_ty)).kind()
&& let ty::Ref(_, search_ty, Mutability::Not) = *cx
.tcx
.instantiate_bound_regions_with_erased(sig.rebind(search_ty))
.kind()
&& let Some(iter_trait) = cx.tcx.get_diagnostic_item(sym::Iterator)
&& let Some(iter_item) = cx.tcx.associated_items(iter_trait).find_by_name_and_kind(
cx.tcx,
2 changes: 1 addition & 1 deletion clippy_lints/src/missing_const_for_fn.rs
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingConstForFn {
FnKind::Closure => return,
}

let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);

// Const fns are not allowed as methods in a trait.
{
2 changes: 1 addition & 1 deletion clippy_lints/src/mixed_read_write_in_expression.rs
Original file line number Diff line number Diff line change
@@ -165,7 +165,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DivergenceVisitor<'a, 'tcx> {
match typ.kind() {
ty::FnDef(..) | ty::FnPtr(_) => {
let sig = typ.fn_sig(self.cx.tcx);
if self.cx.tcx.erase_late_bound_regions(sig).output().kind() == &ty::Never {
if self.cx.tcx.instantiate_bound_regions_with_erased(sig).output().kind() == &ty::Never {
self.report_diverging_sub_expr(e);
}
},
6 changes: 5 additions & 1 deletion clippy_lints/src/mut_key.rs
Original file line number Diff line number Diff line change
@@ -143,7 +143,11 @@ impl MutableKeyType {
for (hir_ty, ty) in iter::zip(decl.inputs, fn_sig.inputs().skip_binder()) {
self.check_ty_(cx, hir_ty.span, *ty);
}
self.check_ty_(cx, decl.output.span(), cx.tcx.erase_late_bound_regions(fn_sig.output()));
self.check_ty_(
cx,
decl.output.span(),
cx.tcx.instantiate_bound_regions_with_erased(fn_sig.output()),
);
}

// We want to lint 1. sets or maps with 2. not immutable key types and 3. no unerased
4 changes: 2 additions & 2 deletions clippy_lints/src/needless_pass_by_ref_mut.rs
Original file line number Diff line number Diff line change
@@ -137,7 +137,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByRefMut<'tcx> {
return;
}

let hir_id = cx.tcx.hir().local_def_id_to_hir_id(fn_def_id);
let hir_id = cx.tcx.local_def_id_to_hir_id(fn_def_id);
let is_async = match kind {
FnKind::ItemFn(.., header) => {
if header.is_unsafe() {
@@ -256,7 +256,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByRefMut<'tcx> {
span_lint_hir_and_then(
cx,
NEEDLESS_PASS_BY_REF_MUT,
cx.tcx.hir().local_def_id_to_hir_id(*fn_def_id),
cx.tcx.local_def_id_to_hir_id(*fn_def_id),
sp,
"this argument is a mutable reference, but not used mutably",
|diag| {
2 changes: 1 addition & 1 deletion clippy_lints/src/needless_pass_by_value.rs
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
return;
}

let hir_id = cx.tcx.hir().local_def_id_to_hir_id(fn_def_id);
let hir_id = cx.tcx.local_def_id_to_hir_id(fn_def_id);

match kind {
FnKind::ItemFn(.., header) => {
4 changes: 2 additions & 2 deletions clippy_lints/src/new_without_default.rs
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ impl<'tcx> LateLintPass<'tcx> for NewWithoutDefault {
let ty = cx.tcx.type_of(d).instantiate_identity();
if let Some(ty_def) = ty.ty_adt_def() {
if let Some(local_def_id) = ty_def.did().as_local() {
impls.insert(cx.tcx.hir().local_def_id_to_hir_id(local_def_id));
impls.insert(cx.tcx.local_def_id_to_hir_id(local_def_id));
}
}
});
@@ -119,7 +119,7 @@ impl<'tcx> LateLintPass<'tcx> for NewWithoutDefault {
&& let self_def = cx.tcx.type_of(self_def_id).instantiate_identity()
&& let Some(self_def) = self_def.ty_adt_def()
&& let Some(self_local_did) = self_def.did().as_local()
&& let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_local_did)
&& let self_id = cx.tcx.local_def_id_to_hir_id(self_local_did)
&& impling_types.contains(&self_id)
{
return;
2 changes: 1 addition & 1 deletion clippy_lints/src/non_send_fields_in_send_ty.rs
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSendFieldInSendTy {
if let Some(field_hir_id) = field
.did
.as_local()
.map(|local_def_id| hir_map.local_def_id_to_hir_id(local_def_id))
.map(|local_def_id| cx.tcx.local_def_id_to_hir_id(local_def_id))
&& !is_lint_allowed(cx, NON_SEND_FIELDS_IN_SEND_TY, field_hir_id)
&& let field_ty = field.ty(cx.tcx, impl_trait_args)
&& !ty_allowed_in_send(cx, field_ty, send_trait)
Loading