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

+3
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

+1-1
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

+2-2
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

+3-3
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

+2-2
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

+1-1
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

+1-1
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

+1-1
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

+3-4
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

+1-1
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
}

clippy_lints/src/mixed_read_write_in_expression.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ fn check_for_unsequenced_reads(vis: &mut ReadVisitor<'_, '_>) {
186186
let map = &vis.cx.tcx.hir();
187187
let mut cur_id = vis.write_expr.hir_id;
188188
loop {
189-
let parent_id = map.get_parent_node(cur_id);
189+
let parent_id = map.parent_id(cur_id);
190190
if parent_id == cur_id {
191191
break;
192192
}

clippy_lints/src/mut_mut.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for MutVisitor<'a, 'tcx> {
8686
return;
8787
}
8888

89-
if let hir::TyKind::Rptr(
89+
if let hir::TyKind::Ref(
9090
_,
9191
hir::MutTy {
9292
ty: pty,
9393
mutbl: hir::Mutability::Mut,
9494
},
9595
) = ty.kind
9696
{
97-
if let hir::TyKind::Rptr(
97+
if let hir::TyKind::Ref(
9898
_,
9999
hir::MutTy {
100100
mutbl: hir::Mutability::Mut,

clippy_lints/src/needless_arbitrary_self_type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl EarlyLintPass for NeedlessArbitrarySelfType {
124124
check_param_inner(cx, path, p.span.to(p.ty.span), &Mode::Value, mutbl);
125125
}
126126
},
127-
TyKind::Rptr(lifetime, mut_ty) => {
127+
TyKind::Ref(lifetime, mut_ty) => {
128128
if_chain! {
129129
if let TyKind::Path(None, path) = &mut_ty.ty.kind;
130130
if let PatKind::Ident(BindingAnnotation::NONE, _, _) = p.pat.kind;

clippy_lints/src/needless_pass_by_value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
100100
}
101101

102102
// Exclude non-inherent impls
103-
if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
103+
if let Some(Node::Item(item)) = cx.tcx.hir().find_parent(hir_id) {
104104
if matches!(
105105
item.kind,
106106
ItemKind::Impl(Impl { of_trait: Some(_), .. }) | ItemKind::Trait(..)

clippy_lints/src/non_copy_const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst {
366366
let mut dereferenced_expr = expr;
367367
let mut needs_check_adjustment = true;
368368
loop {
369-
let parent_id = cx.tcx.hir().get_parent_node(cur_expr.hir_id);
369+
let parent_id = cx.tcx.hir().parent_id(cur_expr.hir_id);
370370
if parent_id == cur_expr.hir_id {
371371
break;
372372
}

clippy_lints/src/pass_by_ref_or_value.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl<'tcx> PassByRefOrValue {
184184
if is_copy(cx, ty)
185185
&& let Some(size) = cx.layout_of(ty).ok().map(|l| l.size.bytes())
186186
&& size <= self.ref_min_size
187-
&& let hir::TyKind::Rptr(_, MutTy { ty: decl_ty, .. }) = input.kind
187+
&& let hir::TyKind::Ref(_, MutTy { ty: decl_ty, .. }) = input.kind
188188
{
189189
if let Some(typeck) = cx.maybe_typeck_results() {
190190
// Don't lint if an unsafe pointer is created.
@@ -299,7 +299,7 @@ impl<'tcx> LateLintPass<'tcx> for PassByRefOrValue {
299299
}
300300

301301
// Exclude non-inherent impls
302-
if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
302+
if let Some(Node::Item(item)) = cx.tcx.hir().find_parent(hir_id) {
303303
if matches!(
304304
item.kind,
305305
ItemKind::Impl(Impl { of_trait: Some(_), .. }) | ItemKind::Trait(..)

clippy_lints/src/ptr.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ fn check_fn_args<'cx, 'tcx: 'cx>(
421421
if let ty::Ref(_, ty, mutability) = *ty.kind();
422422
if let ty::Adt(adt, substs) = *ty.kind();
423423

424-
if let TyKind::Rptr(lt, ref ty) = hir_ty.kind;
424+
if let TyKind::Ref(lt, ref ty) = hir_ty.kind;
425425
if let TyKind::Path(QPath::Resolved(None, path)) = ty.ty.kind;
426426

427427
// Check that the name as typed matches the actual name of the type.
@@ -503,14 +503,14 @@ fn check_fn_args<'cx, 'tcx: 'cx>(
503503

504504
fn check_mut_from_ref<'tcx>(cx: &LateContext<'tcx>, sig: &FnSig<'_>, body: Option<&'tcx Body<'_>>) {
505505
if let FnRetTy::Return(ty) = sig.decl.output
506-
&& let Some((out, Mutability::Mut, _)) = get_rptr_lm(ty)
506+
&& let Some((out, Mutability::Mut, _)) = get_ref_lm(ty)
507507
{
508508
let out_region = cx.tcx.named_region(out.hir_id);
509509
let args: Option<Vec<_>> = sig
510510
.decl
511511
.inputs
512512
.iter()
513-
.filter_map(get_rptr_lm)
513+
.filter_map(get_ref_lm)
514514
.filter(|&(lt, _, _)| cx.tcx.named_region(lt.hir_id) == out_region)
515515
.map(|(_, mutability, span)| (mutability == Mutability::Not).then_some(span))
516516
.collect();
@@ -704,8 +704,8 @@ fn matches_preds<'tcx>(
704704
})
705705
}
706706

707-
fn get_rptr_lm<'tcx>(ty: &'tcx hir::Ty<'tcx>) -> Option<(&'tcx Lifetime, Mutability, Span)> {
708-
if let TyKind::Rptr(lt, ref m) = ty.kind {
707+
fn get_ref_lm<'tcx>(ty: &'tcx hir::Ty<'tcx>) -> Option<(&'tcx Lifetime, Mutability, Span)> {
708+
if let TyKind::Ref(lt, ref m) = ty.kind {
709709
Some((lt, m.mutbl, ty.span))
710710
} else {
711711
None

clippy_lints/src/redundant_static_lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl RedundantStaticLifetimes {
5959
}
6060
},
6161
// This is what we are looking for !
62-
TyKind::Rptr(ref optional_lifetime, ref borrow_type) => {
62+
TyKind::Ref(ref optional_lifetime, ref borrow_type) => {
6363
// Match the 'static lifetime
6464
if let Some(lifetime) = *optional_lifetime {
6565
match borrow_type.ty.kind {

clippy_lints/src/ref_option_ref.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ declare_lint_pass!(RefOptionRef => [REF_OPTION_REF]);
3939
impl<'tcx> LateLintPass<'tcx> for RefOptionRef {
4040
fn check_ty(&mut self, cx: &LateContext<'tcx>, ty: &'tcx Ty<'tcx>) {
4141
if_chain! {
42-
if let TyKind::Rptr(_, ref mut_ty) = ty.kind;
42+
if let TyKind::Ref(_, ref mut_ty) = ty.kind;
4343
if mut_ty.mutbl == Mutability::Not;
4444
if let TyKind::Path(ref qpath) = &mut_ty.ty.kind;
4545
let last = last_path_segment(qpath);
@@ -52,7 +52,7 @@ impl<'tcx> LateLintPass<'tcx> for RefOptionRef {
5252
GenericArg::Type(inner_ty) => Some(inner_ty),
5353
_ => None,
5454
});
55-
if let TyKind::Rptr(_, ref inner_mut_ty) = inner_ty.kind;
55+
if let TyKind::Ref(_, ref inner_mut_ty) = inner_ty.kind;
5656
if inner_mut_ty.mutbl == Mutability::Not;
5757

5858
then {

clippy_lints/src/transmute/transmute_ptr_to_ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub(super) fn check<'tcx>(
7171
/// Gets the type `Bar` in `…::transmute<Foo, &Bar>`.
7272
fn get_explicit_type<'tcx>(path: &'tcx Path<'tcx>) -> Option<&'tcx hir::Ty<'tcx>> {
7373
if let GenericArg::Type(ty) = path.segments.last()?.args?.args.get(1)?
74-
&& let TyKind::Rptr(_, ty) = &ty.kind
74+
&& let TyKind::Ref(_, ty) = &ty.kind
7575
{
7676
Some(ty.ty)
7777
} else {

clippy_lints/src/types/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ impl Types {
539539
QPath::LangItem(..) => {},
540540
}
541541
},
542-
TyKind::Rptr(lt, ref mut_ty) => {
542+
TyKind::Ref(lt, ref mut_ty) => {
543543
context.is_nested_call = true;
544544
if !borrowed_box::check(cx, hir_ty, lt, mut_ty) {
545545
self.check_ty(cx, mut_ty.ty, context);

clippy_lints/src/types/type_complexity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<'tcx> Visitor<'tcx> for TypeComplexityVisitor {
4444
fn visit_ty(&mut self, ty: &'tcx hir::Ty<'_>) {
4545
let (add_score, sub_nest) = match ty.kind {
4646
// _, &x and *x have only small overhead; don't mess with nesting level
47-
TyKind::Infer | TyKind::Ptr(..) | TyKind::Rptr(..) => (1, 0),
47+
TyKind::Infer | TyKind::Ptr(..) | TyKind::Ref(..) => (1, 0),
4848

4949
// the "normal" components of a type: named types, arrays/tuples
5050
TyKind::Path(..) | TyKind::Slice(..) | TyKind::Tup(..) | TyKind::Array(..) => (10 * self.nest, 1),

clippy_lints/src/types/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub(super) fn match_borrows_parameter(_cx: &LateContext<'_>, qpath: &QPath<'_>)
1313
GenericArg::Type(ty) => Some(ty),
1414
_ => None,
1515
});
16-
if let TyKind::Rptr(..) = ty.kind;
16+
if let TyKind::Ref(..) = ty.kind;
1717
then {
1818
return Some(ty.span);
1919
}

clippy_lints/src/unit_types/unit_arg.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
2121
return;
2222
}
2323
let map = &cx.tcx.hir();
24-
let opt_parent_node = map.find(map.get_parent_node(expr.hir_id));
24+
let opt_parent_node = map.find_parent(expr.hir_id);
2525
if_chain! {
2626
if let Some(hir::Node::Expr(parent_expr)) = opt_parent_node;
2727
if is_questionmark_desugar_marked_call(parent_expr);
@@ -192,7 +192,7 @@ fn fmt_stmts_and_call(
192192

193193
let mut stmts_and_call_snippet = stmts_and_call.join(&format!("{}{}", ";\n", " ".repeat(call_expr_indent)));
194194
// expr is not in a block statement or result expression position, wrap in a block
195-
let parent_node = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(call_expr.hir_id));
195+
let parent_node = cx.tcx.hir().find_parent(call_expr.hir_id);
196196
if !matches!(parent_node, Some(Node::Block(_))) && !matches!(parent_node, Some(Node::Stmt(_))) {
197197
let block_indent = call_expr_indent + 4;
198198
stmts_and_call_snippet =

clippy_lints/src/unnecessary_wraps.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWraps {
9191
}
9292

9393
// Abort if the method is implementing a trait or of it a trait method.
94-
if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
94+
if let Some(Node::Item(item)) = cx.tcx.hir().find_parent(hir_id) {
9595
if matches!(
9696
item.kind,
9797
ItemKind::Impl(Impl { of_trait: Some(_), .. }) | ItemKind::Trait(..)

clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl<'tcx> LateLintPass<'tcx> for LintWithoutLintPass {
257257
}
258258

259259
pub(super) fn is_lint_ref_type(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> bool {
260-
if let TyKind::Rptr(
260+
if let TyKind::Ref(
261261
_,
262262
MutTy {
263263
ty: inner,

clippy_lints/src/utils/internal_lints/metadata_collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ fn get_parent_local<'hir>(cx: &LateContext<'hir>, expr: &'hir hir::Expr<'hir>) -
10581058
fn get_parent_local_hir_id<'hir>(cx: &LateContext<'hir>, hir_id: hir::HirId) -> Option<&'hir hir::Local<'hir>> {
10591059
let map = cx.tcx.hir();
10601060

1061-
match map.find(map.get_parent_node(hir_id)) {
1061+
match map.find_parent(hir_id) {
10621062
Some(hir::Node::Local(local)) => Some(local),
10631063
Some(hir::Node::Pat(pattern)) => get_parent_local_hir_id(cx, pattern.hir_id),
10641064
_ => None,

clippy_lints/src/utils/internal_lints/unnecessary_def_path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ fn path_to_matched_type(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> Option<Ve
219219
match peel_hir_expr_refs(expr).0.kind {
220220
ExprKind::Path(ref qpath) => match cx.qpath_res(qpath, expr.hir_id) {
221221
Res::Local(hir_id) => {
222-
let parent_id = cx.tcx.hir().get_parent_node(hir_id);
222+
let parent_id = cx.tcx.hir().parent_id(hir_id);
223223
if let Some(Node::Local(Local { init: Some(init), .. })) = cx.tcx.hir().find(parent_id) {
224224
path_to_matched_type(cx, init)
225225
} else {

clippy_utils/src/ast_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ pub fn eq_ty(l: &Ty, r: &Ty) -> bool {
625625
(Slice(l), Slice(r)) => eq_ty(l, r),
626626
(Array(le, ls), Array(re, rs)) => eq_ty(le, re) && eq_expr(&ls.value, &rs.value),
627627
(Ptr(l), Ptr(r)) => l.mutbl == r.mutbl && eq_ty(&l.ty, &r.ty),
628-
(Rptr(ll, l), Rptr(rl, r)) => {
628+
(Ref(ll, l), Ref(rl, r)) => {
629629
both(ll, rl, |l, r| eq_id(l.ident, r.ident)) && l.mutbl == r.mutbl && eq_ty(&l.ty, &r.ty)
630630
},
631631
(BareFn(l), BareFn(r)) => {

clippy_utils/src/hir_utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ impl HirEqInterExpr<'_, '_, '_> {
430430
(&TyKind::Slice(l_vec), &TyKind::Slice(r_vec)) => self.eq_ty(l_vec, r_vec),
431431
(&TyKind::Array(lt, ll), &TyKind::Array(rt, rl)) => self.eq_ty(lt, rt) && self.eq_array_length(ll, rl),
432432
(TyKind::Ptr(l_mut), TyKind::Ptr(r_mut)) => l_mut.mutbl == r_mut.mutbl && self.eq_ty(l_mut.ty, r_mut.ty),
433-
(TyKind::Rptr(_, l_rmut), TyKind::Rptr(_, r_rmut)) => {
433+
(TyKind::Ref(_, l_rmut), TyKind::Ref(_, r_rmut)) => {
434434
l_rmut.mutbl == r_rmut.mutbl && self.eq_ty(l_rmut.ty, r_rmut.ty)
435435
},
436436
(TyKind::Path(l), TyKind::Path(r)) => self.eq_qpath(l, r),
@@ -950,7 +950,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
950950
self.hash_ty(mut_ty.ty);
951951
mut_ty.mutbl.hash(&mut self.s);
952952
},
953-
TyKind::Rptr(lifetime, ref mut_ty) => {
953+
TyKind::Ref(lifetime, ref mut_ty) => {
954954
self.hash_lifetime(lifetime);
955955
self.hash_ty(mut_ty.ty);
956956
mut_ty.mutbl.hash(&mut self.s);

0 commit comments

Comments
 (0)