Skip to content

Commit 61aa5c9

Browse files
authored
Merge pull request rust-lang#3902 from matthiaskrgr/rustup
rustup rust-lang#59096
2 parents c7d4445 + b5d8252 commit 61aa5c9

File tree

6 files changed

+11
-20
lines changed

6 files changed

+11
-20
lines changed

clippy_lints/src/functions.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,7 @@ impl<'a, 'tcx> Functions {
256256
hir_id: hir::HirId,
257257
) {
258258
let expr = &body.value;
259-
let node_id = cx.tcx.hir().hir_to_node_id(hir_id);
260-
if unsafety == hir::Unsafety::Normal && cx.access_levels.is_exported(node_id) {
259+
if unsafety == hir::Unsafety::Normal && cx.access_levels.is_exported(hir_id) {
261260
let raw_ptrs = iter_input_pats(decl, body)
262261
.zip(decl.inputs.iter())
263262
.filter_map(|(arg, ty)| raw_ptr_arg(arg, ty))

clippy_lints/src/len_zero.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items
148148
}
149149
}
150150

151-
let trait_node_id = cx.tcx.hir().hir_to_node_id(visited_trait.hir_id);
152-
153-
if cx.access_levels.is_exported(trait_node_id) && trait_items.iter().any(|i| is_named_self(cx, i, "len")) {
151+
if cx.access_levels.is_exported(visited_trait.hir_id) && trait_items.iter().any(|i| is_named_self(cx, i, "len")) {
154152
let mut current_and_super_traits = FxHashSet::default();
155153
let visited_trait_def_id = cx.tcx.hir().local_def_id_from_hir_id(visited_trait.hir_id);
156154
fill_trait_set(visited_trait_def_id, &mut current_and_super_traits, cx);
@@ -193,10 +191,7 @@ fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item, impl_items: &[ImplIte
193191
}
194192

195193
let is_empty = if let Some(is_empty) = impl_items.iter().find(|i| is_named_self(cx, i, "is_empty")) {
196-
if cx
197-
.access_levels
198-
.is_exported(cx.tcx.hir().hir_to_node_id(is_empty.id.hir_id))
199-
{
194+
if cx.access_levels.is_exported(is_empty.id.hir_id) {
200195
return;
201196
} else {
202197
"a private"
@@ -206,7 +201,7 @@ fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item, impl_items: &[ImplIte
206201
};
207202

208203
if let Some(i) = impl_items.iter().find(|i| is_named_self(cx, i, "len")) {
209-
if cx.access_levels.is_exported(cx.tcx.hir().hir_to_node_id(i.id.hir_id)) {
204+
if cx.access_levels.is_exported(i.id.hir_id) {
210205
let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
211206
let ty = cx.tcx.type_of(def_id);
212207

clippy_lints/src/methods/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
918918
if let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.hir().body(id)).next();
919919
if let hir::ItemKind::Impl(_, _, _, _, None, ref self_ty, _) = item.node;
920920
then {
921-
let node_id = cx.tcx.hir().hir_to_node_id(implitem.hir_id);
922-
if cx.access_levels.is_exported(node_id) {
921+
if cx.access_levels.is_exported(implitem.hir_id) {
923922
// check missing trait implementations
924923
for &(method_name, n_args, self_kind, out_type, trait_name) in &TRAIT_METHODS {
925924
if name == method_name &&

clippy_lints/src/missing_inline.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
9595
return;
9696
}
9797

98-
if !cx.access_levels.is_exported(cx.tcx.hir().hir_to_node_id(it.hir_id)) {
98+
if !cx.access_levels.is_exported(it.hir_id) {
9999
return;
100100
}
101101
match it.node {
@@ -146,8 +146,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
146146
}
147147

148148
// If the item being implemented is not exported, then we don't need #[inline]
149-
let node_id = cx.tcx.hir().hir_to_node_id(impl_item.hir_id);
150-
if !cx.access_levels.is_exported(node_id) {
149+
if !cx.access_levels.is_exported(impl_item.hir_id) {
151150
return;
152151
}
153152

@@ -163,8 +162,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
163162
};
164163

165164
if let Some(trait_def_id) = trait_def_id {
166-
if let Some(n) = cx.tcx.hir().as_local_node_id(trait_def_id) {
167-
if !cx.access_levels.is_exported(n) {
165+
if cx.tcx.hir().as_local_node_id(trait_def_id).is_some() {
166+
if !cx.access_levels.is_exported(impl_item.hir_id) {
168167
// If a trait is being implemented for an item, and the
169168
// trait is not exported, we don't need #[inline]
170169
return;

clippy_lints/src/new_without_default.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
111111
if let hir::ImplItemKind::Method(ref sig, _) = impl_item.node {
112112
let name = impl_item.ident.name;
113113
let id = impl_item.hir_id;
114-
let node_id = cx.tcx.hir().hir_to_node_id(id);
115114
if sig.header.constness == hir::Constness::Const {
116115
// can't be implemented by default
117116
return;
@@ -129,7 +128,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
129128
// impl of `Default`
130129
return;
131130
}
132-
if sig.decl.inputs.is_empty() && name == "new" && cx.access_levels.is_reachable(node_id) {
131+
if sig.decl.inputs.is_empty() && name == "new" && cx.access_levels.is_reachable(id) {
133132
let self_did = cx.tcx.hir().local_def_id_from_hir_id(cx.tcx.hir().get_parent_item(id));
134133
let self_ty = cx.tcx.type_of(self_did);
135134
if_chain! {

clippy_lints/src/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2075,7 +2075,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitHasher {
20752075
}
20762076
}
20772077

2078-
if !cx.access_levels.is_exported(cx.tcx.hir().hir_to_node_id(item.hir_id)) {
2078+
if !cx.access_levels.is_exported(item.hir_id) {
20792079
return;
20802080
}
20812081

0 commit comments

Comments
 (0)