Skip to content

Commit 5b7c206

Browse files
committed
Don't use TyKind directly, use ty instead
1 parent 9ceece9 commit 5b7c206

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

clippy_lints/src/collect.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use itertools::{repeat_n, Itertools};
2-
use rustc::hir::*;
3-
use rustc::ty::{AssociatedKind, TyKind};
2+
use rustc::hir::{Expr, Stmt, DeclKind, StmtKind, ExprKind};
3+
use rustc::ty::{AssociatedKind};
44
use syntax::ast::NodeId;
55

66
use std::collections::HashSet;
@@ -9,7 +9,7 @@ use crate::rustc_errors::Applicability;
99
use crate::rustc::lint::{
1010
LateContext, LateLintPass, LintArray, LintPass,
1111
};
12-
use crate::rustc::{declare_tool_lint, lint_array};
12+
use crate::rustc::{declare_tool_lint, lint_array, ty};
1313
use crate::utils::{match_trait_method, match_type, span_lint_and_sugg};
1414
use crate::utils::paths;
1515

@@ -75,11 +75,11 @@ struct Suggestion {
7575

7676
fn format_suggestion_pattern<'a, 'tcx>(
7777
cx: &LateContext<'a, 'tcx>,
78-
collection_ty: &TyKind<'_>,
78+
collection_ty: &ty::Ty<'_>,
7979
is_option: bool,
8080
) -> String {
81-
let collection_pat = match collection_ty {
82-
TyKind::Adt(def, subs) => {
81+
let collection_pat = match collection_ty.sty {
82+
ty::Adt(def, subs) => {
8383
let mut buf = cx.tcx.item_path_str(def.did);
8484

8585
if !subs.is_empty() {
@@ -90,7 +90,7 @@ fn format_suggestion_pattern<'a, 'tcx>(
9090

9191
buf
9292
},
93-
TyKind::Param(p) => p.to_string(),
93+
ty::Param(p) => p.to_string(),
9494
_ => "_".into(),
9595
};
9696

@@ -131,13 +131,13 @@ fn check_expr_for_collect<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr
131131

132132
return if match_type(cx, normal_ty, &paths::OPTION) {
133133
Some(Suggestion {
134-
pattern: format_suggestion_pattern(cx, &collect_ty.sty.clone(), true),
134+
pattern: format_suggestion_pattern(cx, &collect_ty, true),
135135
type_colloquial: "Option",
136136
success_variant: "Some",
137137
})
138138
} else if match_type(cx, normal_ty, &paths::RESULT) {
139139
Some(Suggestion {
140-
pattern: format_suggestion_pattern(cx, &collect_ty.sty.clone(), false),
140+
pattern: format_suggestion_pattern(cx, &collect_ty, false),
141141
type_colloquial: "Result",
142142
success_variant: "Ok",
143143
})

0 commit comments

Comments
 (0)