Skip to content

Commit 9b7ff50

Browse files
committed
Replace most of ty:Ty with Ty
1 parent 4832a85 commit 9b7ff50

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

clippy_lints/src/consts.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl Hash for Constant {
117117
}
118118

119119
impl Constant {
120-
pub fn partial_cmp(tcx: TyCtxt<'_, '_, '_>, cmp_type: ty::Ty<'_>, left: &Self, right: &Self) -> Option<Ordering> {
120+
pub fn partial_cmp(tcx: TyCtxt<'_, '_, '_>, cmp_type: Ty<'_>, left: &Self, right: &Self) -> Option<Ordering> {
121121
match (left, right) {
122122
(&Constant::Str(ref ls), &Constant::Str(ref rs)) => Some(ls.cmp(rs)),
123123
(&Constant::Char(ref l), &Constant::Char(ref r)) => Some(l.cmp(r)),
@@ -268,7 +268,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
268268
}
269269

270270
#[allow(clippy::cast_possible_wrap)]
271-
fn constant_not(&self, o: &Constant, ty: ty::Ty<'_>) -> Option<Constant> {
271+
fn constant_not(&self, o: &Constant, ty: Ty<'_>) -> Option<Constant> {
272272
use self::Constant::*;
273273
match *o {
274274
Bool(b) => Some(Bool(!b)),
@@ -284,7 +284,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
284284
}
285285
}
286286

287-
fn constant_negate(&self, o: &Constant, ty: ty::Ty<'_>) -> Option<Constant> {
287+
fn constant_negate(&self, o: &Constant, ty: Ty<'_>) -> Option<Constant> {
288288
use self::Constant::*;
289289
match *o {
290290
Int(value) => {

clippy_lints/src/eta_reduction.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use if_chain::if_chain;
22
use rustc::hir::*;
33
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
4-
use rustc::ty;
4+
use rustc::ty::{self, Ty};
55
use rustc::{declare_tool_lint, lint_array};
66
use rustc_errors::Applicability;
77

@@ -147,7 +147,7 @@ fn get_ufcs_type_name(
147147
})
148148
}
149149

150-
fn match_borrow_depth(lhs: ty::Ty<'_>, rhs: ty::Ty<'_>) -> bool {
150+
fn match_borrow_depth(lhs: Ty<'_>, rhs: Ty<'_>) -> bool {
151151
match (&lhs.sty, &rhs.sty) {
152152
(ty::Ref(_, t1, _), ty::Ref(_, t2, _)) => match_borrow_depth(&t1, &t2),
153153
(l, r) => match (l, r) {
@@ -157,7 +157,7 @@ fn match_borrow_depth(lhs: ty::Ty<'_>, rhs: ty::Ty<'_>) -> bool {
157157
}
158158
}
159159

160-
fn match_types(lhs: ty::Ty<'_>, rhs: ty::Ty<'_>) -> bool {
160+
fn match_types(lhs: Ty<'_>, rhs: Ty<'_>) -> bool {
161161
match (&lhs.sty, &rhs.sty) {
162162
(ty::Bool, ty::Bool)
163163
| (ty::Char, ty::Char)
@@ -172,7 +172,7 @@ fn match_types(lhs: ty::Ty<'_>, rhs: ty::Ty<'_>) -> bool {
172172
}
173173
}
174174

175-
fn get_type_name(cx: &LateContext<'_, '_>, ty: ty::Ty<'_>) -> String {
175+
fn get_type_name(cx: &LateContext<'_, '_>, ty: Ty<'_>) -> String {
176176
match ty.sty {
177177
ty::Adt(t, _) => cx.tcx.def_path_str(t.did),
178178
ty::Ref(_, r, _) => get_type_name(cx, &r),

clippy_lints/src/fallible_impl_from.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::utils::{is_expn_of, match_def_path, method_chain_args, span_lint_and_
33
use if_chain::if_chain;
44
use rustc::hir;
55
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
6-
use rustc::ty;
6+
use rustc::ty::{self, Ty};
77
use rustc::{declare_tool_lint, lint_array};
88
use syntax_pos::Span;
99

@@ -132,7 +132,7 @@ fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_it
132132
}
133133
}
134134

135-
fn match_type<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, ty: ty::Ty<'_>, path: &[&str]) -> bool {
135+
fn match_type<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'_>, path: &[&str]) -> bool {
136136
match ty.sty {
137137
ty::Adt(adt, _) => match_def_path(tcx, adt.did, path),
138138
_ => false,

clippy_lints/src/map_unit_fn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::utils::{in_macro, iter_input_pats, match_type, method_chain_args, sni
33
use if_chain::if_chain;
44
use rustc::hir;
55
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
6-
use rustc::ty;
6+
use rustc::ty::{self, Ty};
77
use rustc::{declare_tool_lint, lint_array};
88
use rustc_errors::Applicability;
99
use syntax::source_map::Span;
@@ -87,7 +87,7 @@ impl LintPass for Pass {
8787
}
8888
}
8989

90-
fn is_unit_type(ty: ty::Ty<'_>) -> bool {
90+
fn is_unit_type(ty: Ty<'_>) -> bool {
9191
match ty.sty {
9292
ty::Tuple(slice) => slice.is_empty(),
9393
ty::Never => true,

clippy_lints/src/methods/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,7 @@ fn lint_asref(cx: &LateContext<'_, '_>, expr: &hir::Expr, call_name: &str, as_re
21962196

21972197
fn ty_has_iter_method(
21982198
cx: &LateContext<'_, '_>,
2199-
self_ref_ty: ty::Ty<'_>,
2199+
self_ref_ty: Ty<'_>,
22002200
) -> Option<(&'static Lint, &'static str, &'static str)> {
22012201
if let Some(ty_name) = has_iter_method(cx, self_ref_ty) {
22022202
let lint = match ty_name {
@@ -2217,7 +2217,7 @@ fn ty_has_iter_method(
22172217
}
22182218
}
22192219

2220-
fn lint_into_iter(cx: &LateContext<'_, '_>, expr: &hir::Expr, self_ref_ty: ty::Ty<'_>, method_span: Span) {
2220+
fn lint_into_iter(cx: &LateContext<'_, '_>, expr: &hir::Expr, self_ref_ty: Ty<'_>, method_span: Span) {
22212221
if !match_trait_method(cx, expr, &paths::INTO_ITERATOR) {
22222222
return;
22232223
}

clippy_lints/src/non_copy_const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc::hir::def::Def;
88
use rustc::hir::*;
99
use rustc::lint::{LateContext, LateLintPass, Lint, LintArray, LintPass};
1010
use rustc::ty::adjustment::Adjust;
11-
use rustc::ty::{self, TypeFlags};
11+
use rustc::ty::{Ty, TypeFlags};
1212
use rustc::{declare_tool_lint, lint_array};
1313
use rustc_errors::Applicability;
1414
use rustc_typeck::hir_ty_to_ty;
@@ -108,7 +108,7 @@ impl Source {
108108
}
109109
}
110110

111-
fn verify_ty_bound<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: ty::Ty<'tcx>, source: Source) {
111+
fn verify_ty_bound<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>, source: Source) {
112112
if ty.is_freeze(cx.tcx, cx.param_env, DUMMY_SP) || is_copy(cx, ty) {
113113
// An `UnsafeCell` is `!Copy`, and an `UnsafeCell` is also the only type which
114114
// is `!Freeze`, thus if our type is `Copy` we can be sure it must be `Freeze`

clippy_lints/src/redundant_clone.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc::mir::{
1212
visit::{MutatingUseContext, PlaceContext, Visitor},
1313
TerminatorKind,
1414
};
15-
use rustc::ty;
15+
use rustc::ty::{self, Ty};
1616
use rustc::{declare_tool_lint, lint_array};
1717
use rustc_errors::Applicability;
1818
use std::convert::TryFrom;
@@ -225,7 +225,7 @@ fn is_call_with_ref_arg<'tcx>(
225225
cx: &LateContext<'_, 'tcx>,
226226
mir: &'tcx mir::Mir<'tcx>,
227227
kind: &'tcx mir::TerminatorKind<'tcx>,
228-
) -> Option<(def_id::DefId, mir::Local, ty::Ty<'tcx>, Option<&'tcx mir::Place<'tcx>>)> {
228+
) -> Option<(def_id::DefId, mir::Local, Ty<'tcx>, Option<&'tcx mir::Place<'tcx>>)> {
229229
if_chain! {
230230
if let TerminatorKind::Call { func, args, destination, .. } = kind;
231231
if args.len() == 1;

clippy_lints/src/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ pub fn any_parent_is_automatically_derived(tcx: TyCtxt<'_, '_, '_>, node: HirId)
10801080
}
10811081

10821082
/// Returns true if ty has `iter` or `iter_mut` methods
1083-
pub fn has_iter_method(cx: &LateContext<'_, '_>, probably_ref_ty: ty::Ty<'_>) -> Option<&'static str> {
1083+
pub fn has_iter_method(cx: &LateContext<'_, '_>, probably_ref_ty: Ty<'_>) -> Option<&'static str> {
10841084
// FIXME: instead of this hard-coded list, we should check if `<adt>::iter`
10851085
// exists and has the desired signature. Unfortunately FnCtxt is not exported
10861086
// so we can't use its `lookup_method` method.

0 commit comments

Comments
 (0)