Skip to content

Commit 6291ef7

Browse files
committed
TyKind
1 parent 381e2e4 commit 6291ef7

18 files changed

+56
-56
lines changed

clippy_lints/src/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl<'a, 'tcx> Functions {
168168
}
169169

170170
fn raw_ptr_arg(arg: &hir::Arg, ty: &hir::Ty) -> Option<ast::NodeId> {
171-
if let (&hir::PatKind::Binding(_, id, _, _), &hir::TyPtr(_)) = (&arg.pat.node, &ty.node) {
171+
if let (&hir::PatKind::Binding(_, id, _, _), &hir::TyKind::Ptr(_)) = (&arg.pat.node, &ty.node) {
172172
Some(id)
173173
} else {
174174
None

clippy_lints/src/lifetimes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,10 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
338338

339339
fn visit_ty(&mut self, ty: &'tcx Ty) {
340340
match ty.node {
341-
TyRptr(ref lt, _) if lt.is_elided() => {
341+
TyKind::Rptr(ref lt, _) if lt.is_elided() => {
342342
self.record(&None);
343343
},
344-
TyPath(ref path) => {
344+
TyKind::Path(ref path) => {
345345
if let QPath::Resolved(_, ref path) = *path {
346346
if let Def::Existential(def_id) = path.def {
347347
let node_id = self.cx.tcx.hir.as_local_node_id(def_id).unwrap();

clippy_lints/src/methods.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,7 @@ impl SelfKind {
20562056
return true;
20572057
}
20582058
match ty.node {
2059-
hir::TyRptr(_, ref mt_ty) => {
2059+
hir::TyKind::Rptr(_, ref mt_ty) => {
20602060
let mutability_match = if self == SelfKind::Ref {
20612061
mt_ty.mutbl == hir::MutImmutable
20622062
} else {
@@ -2127,8 +2127,8 @@ fn is_as_ref_or_mut_trait(ty: &hir::Ty, self_ty: &hir::Ty, generics: &hir::Gener
21272127
fn is_ty(ty: &hir::Ty, self_ty: &hir::Ty) -> bool {
21282128
match (&ty.node, &self_ty.node) {
21292129
(
2130-
&hir::TyPath(hir::QPath::Resolved(_, ref ty_path)),
2131-
&hir::TyPath(hir::QPath::Resolved(_, ref self_ty_path)),
2130+
&hir::TyKind::Path(hir::QPath::Resolved(_, ref ty_path)),
2131+
&hir::TyKind::Path(hir::QPath::Resolved(_, ref self_ty_path)),
21322132
) => ty_path
21332133
.segments
21342134
.iter()
@@ -2139,7 +2139,7 @@ fn is_ty(ty: &hir::Ty, self_ty: &hir::Ty) -> bool {
21392139
}
21402140

21412141
fn single_segment_ty(ty: &hir::Ty) -> Option<&hir::PathSegment> {
2142-
if let hir::TyPath(ref path) = ty.node {
2142+
if let hir::TyKind::Path(ref path) = ty.node {
21432143
single_segment_path(path)
21442144
} else {
21452145
None
@@ -2176,17 +2176,17 @@ impl OutType {
21762176
fn matches(self, ty: &hir::FunctionRetTy) -> bool {
21772177
match (self, ty) {
21782178
(OutType::Unit, &hir::DefaultReturn(_)) => true,
2179-
(OutType::Unit, &hir::Return(ref ty)) if ty.node == hir::TyTup(vec![].into()) => true,
2179+
(OutType::Unit, &hir::Return(ref ty)) if ty.node == hir::TyKind::Tup(vec![].into()) => true,
21802180
(OutType::Bool, &hir::Return(ref ty)) if is_bool(ty) => true,
2181-
(OutType::Any, &hir::Return(ref ty)) if ty.node != hir::TyTup(vec![].into()) => true,
2182-
(OutType::Ref, &hir::Return(ref ty)) => matches!(ty.node, hir::TyRptr(_, _)),
2181+
(OutType::Any, &hir::Return(ref ty)) if ty.node != hir::TyKind::Tup(vec![].into()) => true,
2182+
(OutType::Ref, &hir::Return(ref ty)) => matches!(ty.node, hir::TyKind::Rptr(_, _)),
21832183
_ => false,
21842184
}
21852185
}
21862186
}
21872187

21882188
fn is_bool(ty: &hir::Ty) -> bool {
2189-
if let hir::TyPath(ref p) = ty.node {
2189+
if let hir::TyKind::Path(ref p) = ty.node {
21902190
match_qpath(p, &["bool"])
21912191
} else {
21922192
false

clippy_lints/src/misc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ fn non_macro_local(cx: &LateContext, def: &def::Def) -> bool {
571571

572572
fn check_cast(cx: &LateContext, span: Span, e: &Expr, ty: &Ty) {
573573
if_chain! {
574-
if let TyPtr(MutTy { mutbl, .. }) = ty.node;
574+
if let TyKind::Ptr(MutTy { mutbl, .. }) = ty.node;
575575
if let ExprKind::Lit(ref lit) = e.node;
576576
if let LitKind::Int(value, ..) = lit.node;
577577
if value == 0;

clippy_lints/src/mut_mut.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for MutVisitor<'a, 'tcx> {
8787
}
8888

8989
fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
90-
if let hir::TyRptr(
90+
if let hir::TyKind::Rptr(
9191
_,
9292
hir::MutTy {
9393
ty: ref pty,
9494
mutbl: hir::MutMutable,
9595
},
9696
) = ty.node
9797
{
98-
if let hir::TyRptr(
98+
if let hir::TyKind::Rptr(
9999
_,
100100
hir::MutTy {
101101
mutbl: hir::MutMutable,

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
215215
if match_type(cx, ty, &paths::VEC);
216216
if let Some(clone_spans) =
217217
get_spans(cx, Some(body.id()), idx, &[("clone", ".to_owned()")]);
218-
if let TyPath(QPath::Resolved(_, ref path)) = input.node;
218+
if let TyKind::Path(QPath::Resolved(_, ref path)) = input.node;
219219
if let Some(elem_ty) = path.segments.iter()
220220
.find(|seg| seg.ident.name == "Vec")
221221
.and_then(|ps| ps.args.as_ref())

clippy_lints/src/ptr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ fn check_fn(cx: &LateContext, decl: &FnDecl, fn_id: NodeId, opt_body_id: Option<
159159
if match_type(cx, ty, &paths::VEC) {
160160
let mut ty_snippet = None;
161161
if_chain! {
162-
if let TyPath(QPath::Resolved(_, ref path)) = walk_ptrs_hir_ty(arg).node;
162+
if let TyKind::Path(QPath::Resolved(_, ref path)) = walk_ptrs_hir_ty(arg).node;
163163
if let Some(&PathSegment{args: Some(ref parameters), ..}) = path.segments.last();
164164
then {
165165
let types: Vec<_> = parameters.args.iter().filter_map(|arg| match arg {
@@ -219,8 +219,8 @@ fn check_fn(cx: &LateContext, decl: &FnDecl, fn_id: NodeId, opt_body_id: Option<
219219
}
220220
} else if match_type(cx, ty, &paths::COW) {
221221
if_chain! {
222-
if let TyRptr(_, MutTy { ref ty, ..} ) = arg.node;
223-
if let TyPath(ref path) = ty.node;
222+
if let TyKind::Rptr(_, MutTy { ref ty, ..} ) = arg.node;
223+
if let TyKind::Path(ref path) = ty.node;
224224
if let QPath::Resolved(None, ref pp) = *path;
225225
if let [ref bx] = *pp.segments;
226226
if let Some(ref params) = bx.args;
@@ -273,7 +273,7 @@ fn check_fn(cx: &LateContext, decl: &FnDecl, fn_id: NodeId, opt_body_id: Option<
273273
}
274274

275275
fn get_rptr_lm(ty: &Ty) -> Option<(&Lifetime, Mutability, Span)> {
276-
if let Ty_::TyRptr(ref lt, ref m) = ty.node {
276+
if let TyKind::Rptr(ref lt, ref m) = ty.node {
277277
Some((lt, m.mutbl, ty.span))
278278
} else {
279279
None

clippy_lints/src/shadow.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,16 +347,16 @@ fn check_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, bindings:
347347

348348
fn check_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty, bindings: &mut Vec<(Name, Span)>) {
349349
match ty.node {
350-
TySlice(ref sty) => check_ty(cx, sty, bindings),
351-
TyArray(ref fty, ref anon_const) => {
350+
TyKind::Slice(ref sty) => check_ty(cx, sty, bindings),
351+
TyKind::Array(ref fty, ref anon_const) => {
352352
check_ty(cx, fty, bindings);
353353
check_expr(cx, &cx.tcx.hir.body(anon_const.body).value, bindings);
354354
},
355-
TyPtr(MutTy { ty: ref mty, .. }) | TyRptr(_, MutTy { ty: ref mty, .. }) => check_ty(cx, mty, bindings),
356-
TyTup(ref tup) => for t in tup {
355+
TyKind::Ptr(MutTy { ty: ref mty, .. }) | TyKind::Rptr(_, MutTy { ty: ref mty, .. }) => check_ty(cx, mty, bindings),
356+
TyKind::Tup(ref tup) => for t in tup {
357357
check_ty(cx, t, bindings)
358358
},
359-
TyTypeof(ref anon_const) => check_expr(cx, &cx.tcx.hir.body(anon_const.body).value, bindings),
359+
TyKind::Typeof(ref anon_const) => check_expr(cx, &cx.tcx.hir.body(anon_const.body).value, bindings),
360360
_ => (),
361361
}
362362
}

clippy_lints/src/swap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn check_manual_swap(cx: &LateContext, block: &Block) {
9090
if SpanlessEq::new(cx).ignore_fn().eq_expr(lhs1, lhs2) {
9191
let ty = walk_ptrs_ty(cx.tables.expr_ty(lhs1));
9292

93-
if matches!(ty.sty, ty::TySlice(_)) ||
93+
if matches!(ty.sty, ty::TyKind::Slice(_)) ||
9494
matches!(ty.sty, ty::TyArray(_, _)) ||
9595
match_type(cx, ty, &paths::VEC) ||
9696
match_type(cx, ty, &paths::VEC_DEQUE) {

clippy_lints/src/transmute.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ fn get_type_snippet(cx: &LateContext, path: &QPath, to_ref_ty: Ty) -> String {
461461
GenericArg::Type(ty) => Some(ty),
462462
GenericArg::Lifetime(_) => None,
463463
}).nth(1);
464-
if let TyRptr(_, ref to_ty) = to_ty.node;
464+
if let TyKind::Rptr(_, ref to_ty) = to_ty.node;
465465
then {
466466
return snippet(cx, to_ty.ty.span, &to_ref_ty.to_string()).to_string();
467467
}

0 commit comments

Comments
 (0)