mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
Merge pull request #3902 from matthiaskrgr/rustup
rustup https://github.com/rust-lang/rust/pull/59096/
This commit is contained in:
commit
61aa5c957c
6 changed files with 11 additions and 20 deletions
|
@ -256,8 +256,7 @@ impl<'a, 'tcx> Functions {
|
||||||
hir_id: hir::HirId,
|
hir_id: hir::HirId,
|
||||||
) {
|
) {
|
||||||
let expr = &body.value;
|
let expr = &body.value;
|
||||||
let node_id = cx.tcx.hir().hir_to_node_id(hir_id);
|
if unsafety == hir::Unsafety::Normal && cx.access_levels.is_exported(hir_id) {
|
||||||
if unsafety == hir::Unsafety::Normal && cx.access_levels.is_exported(node_id) {
|
|
||||||
let raw_ptrs = iter_input_pats(decl, body)
|
let raw_ptrs = iter_input_pats(decl, body)
|
||||||
.zip(decl.inputs.iter())
|
.zip(decl.inputs.iter())
|
||||||
.filter_map(|(arg, ty)| raw_ptr_arg(arg, ty))
|
.filter_map(|(arg, ty)| raw_ptr_arg(arg, ty))
|
||||||
|
|
|
@ -148,9 +148,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let trait_node_id = cx.tcx.hir().hir_to_node_id(visited_trait.hir_id);
|
if cx.access_levels.is_exported(visited_trait.hir_id) && trait_items.iter().any(|i| is_named_self(cx, i, "len")) {
|
||||||
|
|
||||||
if cx.access_levels.is_exported(trait_node_id) && trait_items.iter().any(|i| is_named_self(cx, i, "len")) {
|
|
||||||
let mut current_and_super_traits = FxHashSet::default();
|
let mut current_and_super_traits = FxHashSet::default();
|
||||||
let visited_trait_def_id = cx.tcx.hir().local_def_id_from_hir_id(visited_trait.hir_id);
|
let visited_trait_def_id = cx.tcx.hir().local_def_id_from_hir_id(visited_trait.hir_id);
|
||||||
fill_trait_set(visited_trait_def_id, &mut current_and_super_traits, cx);
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
let is_empty = if let Some(is_empty) = impl_items.iter().find(|i| is_named_self(cx, i, "is_empty")) {
|
let is_empty = if let Some(is_empty) = impl_items.iter().find(|i| is_named_self(cx, i, "is_empty")) {
|
||||||
if cx
|
if cx.access_levels.is_exported(is_empty.id.hir_id) {
|
||||||
.access_levels
|
|
||||||
.is_exported(cx.tcx.hir().hir_to_node_id(is_empty.id.hir_id))
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
"a private"
|
"a private"
|
||||||
|
@ -206,7 +201,7 @@ fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item, impl_items: &[ImplIte
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(i) = impl_items.iter().find(|i| is_named_self(cx, i, "len")) {
|
if let Some(i) = impl_items.iter().find(|i| is_named_self(cx, i, "len")) {
|
||||||
if cx.access_levels.is_exported(cx.tcx.hir().hir_to_node_id(i.id.hir_id)) {
|
if cx.access_levels.is_exported(i.id.hir_id) {
|
||||||
let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
|
||||||
let ty = cx.tcx.type_of(def_id);
|
let ty = cx.tcx.type_of(def_id);
|
||||||
|
|
||||||
|
|
|
@ -918,8 +918,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
||||||
if let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.hir().body(id)).next();
|
if let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.hir().body(id)).next();
|
||||||
if let hir::ItemKind::Impl(_, _, _, _, None, ref self_ty, _) = item.node;
|
if let hir::ItemKind::Impl(_, _, _, _, None, ref self_ty, _) = item.node;
|
||||||
then {
|
then {
|
||||||
let node_id = cx.tcx.hir().hir_to_node_id(implitem.hir_id);
|
if cx.access_levels.is_exported(implitem.hir_id) {
|
||||||
if cx.access_levels.is_exported(node_id) {
|
|
||||||
// check missing trait implementations
|
// check missing trait implementations
|
||||||
for &(method_name, n_args, self_kind, out_type, trait_name) in &TRAIT_METHODS {
|
for &(method_name, n_args, self_kind, out_type, trait_name) in &TRAIT_METHODS {
|
||||||
if name == method_name &&
|
if name == method_name &&
|
||||||
|
|
|
@ -95,7 +95,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cx.access_levels.is_exported(cx.tcx.hir().hir_to_node_id(it.hir_id)) {
|
if !cx.access_levels.is_exported(it.hir_id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
match it.node {
|
match it.node {
|
||||||
|
@ -146,8 +146,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the item being implemented is not exported, then we don't need #[inline]
|
// If the item being implemented is not exported, then we don't need #[inline]
|
||||||
let node_id = cx.tcx.hir().hir_to_node_id(impl_item.hir_id);
|
if !cx.access_levels.is_exported(impl_item.hir_id) {
|
||||||
if !cx.access_levels.is_exported(node_id) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,8 +162,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(trait_def_id) = trait_def_id {
|
if let Some(trait_def_id) = trait_def_id {
|
||||||
if let Some(n) = cx.tcx.hir().as_local_node_id(trait_def_id) {
|
if cx.tcx.hir().as_local_node_id(trait_def_id).is_some() {
|
||||||
if !cx.access_levels.is_exported(n) {
|
if !cx.access_levels.is_exported(impl_item.hir_id) {
|
||||||
// If a trait is being implemented for an item, and the
|
// If a trait is being implemented for an item, and the
|
||||||
// trait is not exported, we don't need #[inline]
|
// trait is not exported, we don't need #[inline]
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -111,7 +111,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
|
||||||
if let hir::ImplItemKind::Method(ref sig, _) = impl_item.node {
|
if let hir::ImplItemKind::Method(ref sig, _) = impl_item.node {
|
||||||
let name = impl_item.ident.name;
|
let name = impl_item.ident.name;
|
||||||
let id = impl_item.hir_id;
|
let id = impl_item.hir_id;
|
||||||
let node_id = cx.tcx.hir().hir_to_node_id(id);
|
|
||||||
if sig.header.constness == hir::Constness::Const {
|
if sig.header.constness == hir::Constness::Const {
|
||||||
// can't be implemented by default
|
// can't be implemented by default
|
||||||
return;
|
return;
|
||||||
|
@ -129,7 +128,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
|
||||||
// impl of `Default`
|
// impl of `Default`
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if sig.decl.inputs.is_empty() && name == "new" && cx.access_levels.is_reachable(node_id) {
|
if sig.decl.inputs.is_empty() && name == "new" && cx.access_levels.is_reachable(id) {
|
||||||
let self_did = cx.tcx.hir().local_def_id_from_hir_id(cx.tcx.hir().get_parent_item(id));
|
let self_did = cx.tcx.hir().local_def_id_from_hir_id(cx.tcx.hir().get_parent_item(id));
|
||||||
let self_ty = cx.tcx.type_of(self_did);
|
let self_ty = cx.tcx.type_of(self_did);
|
||||||
if_chain! {
|
if_chain! {
|
||||||
|
|
|
@ -2075,7 +2075,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitHasher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cx.access_levels.is_exported(cx.tcx.hir().hir_to_node_id(item.hir_id)) {
|
if !cx.access_levels.is_exported(item.hir_id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue