Skip to content

Commit 0b8ee70

Browse files
committed
Auto merge of #10191 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents f9ca9d4 + cd76d57 commit 0b8ee70

39 files changed

+64
-64
lines changed

clippy_dev/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// warn on lints, that are included in `rust-lang/rust`s bootstrap
66
#![warn(rust_2018_idioms, unused_lifetimes)]
77

8+
// The `rustc_driver` crate seems to be required in order to use the `rust_lexer` crate.
9+
#[allow(unused_extern_crates)]
10+
extern crate rustc_driver;
811
extern crate rustc_lexer;
912

1013
use std::path::PathBuf;

clippy_lints/src/casts/cast_slice_different_sizes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>, msrv: &Msrv
6868
fn is_child_of_cast(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
6969
let map = cx.tcx.hir();
7070
if_chain! {
71-
if let Some(parent_id) = map.find_parent_node(expr.hir_id);
71+
if let Some(parent_id) = map.opt_parent_id(expr.hir_id);
7272
if let Some(parent) = map.find(parent_id);
7373
then {
7474
let expr = match parent {

clippy_lints/src/dereference.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,14 +969,14 @@ fn binding_ty_auto_deref_stability<'tcx>(
969969
precedence: i8,
970970
binder_args: &'tcx List<BoundVariableKind>,
971971
) -> Position {
972-
let TyKind::Rptr(_, ty) = &ty.kind else {
972+
let TyKind::Ref(_, ty) = &ty.kind else {
973973
return Position::Other(precedence);
974974
};
975975
let mut ty = ty;
976976

977977
loop {
978978
break match ty.ty.kind {
979-
TyKind::Rptr(_, ref ref_ty) => {
979+
TyKind::Ref(_, ref ref_ty) => {
980980
ty = ref_ty;
981981
continue;
982982
},

clippy_lints/src/escape.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn is_argument(map: rustc_middle::hir::map::Map<'_>, id: HirId) -> bool {
131131
_ => return false,
132132
}
133133

134-
matches!(map.find(map.get_parent_node(id)), Some(Node::Param(_)))
134+
matches!(map.find_parent(id), Some(Node::Param(_)))
135135
}
136136

137137
impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
@@ -156,8 +156,8 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
156156
let map = &self.cx.tcx.hir();
157157
if is_argument(*map, cmt.hir_id) {
158158
// Skip closure arguments
159-
let parent_id = map.get_parent_node(cmt.hir_id);
160-
if let Some(Node::Expr(..)) = map.find(map.get_parent_node(parent_id)) {
159+
let parent_id = map.parent_id(cmt.hir_id);
160+
if let Some(Node::Expr(..)) = map.find_parent(parent_id) {
161161
return;
162162
}
163163

clippy_lints/src/index_refutable_slice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,15 @@ impl<'a, 'tcx> Visitor<'tcx> for SliceIndexLintingVisitor<'a, 'tcx> {
251251
let map = cx.tcx.hir();
252252

253253
// Checking for slice indexing
254-
let parent_id = map.get_parent_node(expr.hir_id);
254+
let parent_id = map.parent_id(expr.hir_id);
255255
if let Some(hir::Node::Expr(parent_expr)) = map.find(parent_id);
256256
if let hir::ExprKind::Index(_, index_expr) = parent_expr.kind;
257257
if let Some((Constant::Int(index_value), _)) = constant(cx, cx.typeck_results(), index_expr);
258258
if let Ok(index_value) = index_value.try_into();
259259
if index_value < max_suggested_slice;
260260

261261
// Make sure that this slice index is read only
262-
let maybe_addrof_id = map.get_parent_node(parent_id);
262+
let maybe_addrof_id = map.parent_id(parent_id);
263263
if let Some(hir::Node::Expr(maybe_addrof_expr)) = map.find(maybe_addrof_id);
264264
if let hir::ExprKind::AddrOf(_kind, hir::Mutability::Not, _inner_expr) = maybe_addrof_expr.kind;
265265
then {

clippy_lints/src/loops/same_item_push.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub(super) fn check<'tcx>(
6363
if let Node::Pat(pat) = node;
6464
if let PatKind::Binding(bind_ann, ..) = pat.kind;
6565
if !matches!(bind_ann, BindingAnnotation(_, Mutability::Mut));
66-
let parent_node = cx.tcx.hir().get_parent_node(hir_id);
66+
let parent_node = cx.tcx.hir().parent_id(hir_id);
6767
if let Some(Node::Local(parent_let_expr)) = cx.tcx.hir().find(parent_node);
6868
if let Some(init) = parent_let_expr.init;
6969
then {

clippy_lints/src/manual_async_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ fn captures_all_lifetimes(inputs: &[Ty<'_>], output_lifetimes: &[LifetimeName])
152152
let input_lifetimes: Vec<LifetimeName> = inputs
153153
.iter()
154154
.filter_map(|ty| {
155-
if let TyKind::Rptr(lt, _) = ty.kind {
155+
if let TyKind::Ref(lt, _) = ty.kind {
156156
Some(lt.res)
157157
} else {
158158
None

clippy_lints/src/manual_rem_euclid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualRemEuclid {
7474
&& let Some(hir_id) = path_to_local(expr3)
7575
&& let Some(Node::Pat(_)) = cx.tcx.hir().find(hir_id) {
7676
// Apply only to params or locals with annotated types
77-
match cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
77+
match cx.tcx.hir().find_parent(hir_id) {
7878
Some(Node::Param(..)) => (),
7979
Some(Node::Local(local)) => {
8080
let Some(ty) = local.ty else { return };

clippy_lints/src/matches/match_single_binding.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ pub(crate) fn check<'a>(cx: &LateContext<'a>, ex: &Expr<'a>, arms: &[Arm<'_>], e
140140
fn opt_parent_assign_span<'a>(cx: &LateContext<'a>, ex: &Expr<'a>) -> Option<AssignmentExpr> {
141141
let map = &cx.tcx.hir();
142142

143-
if let Some(Node::Expr(parent_arm_expr)) = map.find(map.get_parent_node(ex.hir_id)) {
144-
return match map.find(map.get_parent_node(parent_arm_expr.hir_id)) {
143+
if let Some(Node::Expr(parent_arm_expr)) = map.find_parent(ex.hir_id) {
144+
return match map.find_parent(parent_arm_expr.hir_id) {
145145
Some(Node::Local(parent_let_expr)) => Some(AssignmentExpr::Local {
146146
span: parent_let_expr.span,
147147
pat_span: parent_let_expr.pat.span(),
@@ -183,8 +183,7 @@ fn sugg_with_curlies<'a>(
183183

184184
// If the parent is already an arm, and the body is another match statement,
185185
// we need curly braces around suggestion
186-
let parent_node_id = cx.tcx.hir().get_parent_node(match_expr.hir_id);
187-
if let Node::Arm(arm) = &cx.tcx.hir().get(parent_node_id) {
186+
if let Node::Arm(arm) = &cx.tcx.hir().get_parent(match_expr.hir_id) {
188187
if let ExprKind::Match(..) = arm.body.kind {
189188
cbrace_end = format!("\n{indent}}}");
190189
// Fix body indent due to the match

clippy_lints/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3986,7 +3986,7 @@ impl OutType {
39863986
(Self::Unit, &hir::FnRetTy::Return(ty)) if is_unit(ty) => true,
39873987
(Self::Bool, &hir::FnRetTy::Return(ty)) if is_bool(ty) => true,
39883988
(Self::Any, &hir::FnRetTy::Return(ty)) if !is_unit(ty) => true,
3989-
(Self::Ref, &hir::FnRetTy::Return(ty)) => matches!(ty.kind, hir::TyKind::Rptr(_, _)),
3989+
(Self::Ref, &hir::FnRetTy::Return(ty)) => matches!(ty.kind, hir::TyKind::Ref(_, _)),
39903990
_ => false,
39913991
}
39923992
}

0 commit comments

Comments
 (0)