Skip to content

Commit a95e707

Browse files
committed
ty::TyKind::X -> ty::X
1 parent 0fcca44 commit a95e707

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

clippy_lints/src/methods/read_line_without_trim.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@ use rustc_hir::Expr;
99
use rustc_hir::QPath;
1010
use rustc_hir::{def::Res, ExprKind};
1111
use rustc_lint::LateContext;
12-
use rustc_middle::ty::{Ty, TyKind};
12+
use rustc_middle::ty::{self, Ty};
1313
use rustc_span::sym;
1414

1515
use super::READ_LINE_WITHOUT_TRIM;
1616

1717
/// Will a `.parse::<ty>()` call fail if the input has a trailing newline?
1818
fn parse_fails_on_trailing_newline(ty: Ty<'_>) -> bool {
1919
// only allow a very limited set of types for now, for which we 100% know parsing will fail
20-
matches!(
21-
ty.kind(),
22-
TyKind::Float(_) | TyKind::Bool | TyKind::Int(_) | TyKind::Uint(_)
23-
)
20+
matches!(ty.kind(), ty::Float(_) | ty::Bool | ty::Int(_) | ty::Uint(_))
2421
}
2522

2623
pub fn check(cx: &LateContext<'_>, call: &Expr<'_>, recv: &Expr<'_>, arg: &Expr<'_>) {
@@ -38,7 +35,7 @@ pub fn check(cx: &LateContext<'_>, call: &Expr<'_>, recv: &Expr<'_>, arg: &Expr<
3835
&& segment.ident.name == sym!(parse)
3936
&& let parse_result_ty = cx.typeck_results().expr_ty(parent)
4037
&& is_type_diagnostic_item(cx, parse_result_ty, sym::Result)
41-
&& let TyKind::Adt(_, substs) = parse_result_ty.kind()
38+
&& let ty::Adt(_, substs) = parse_result_ty.kind()
4239
&& let Some(ok_ty) = substs[0].as_type()
4340
&& parse_fails_on_trailing_newline(ok_ty)
4441
{

0 commit comments

Comments
 (0)