Skip to content

Commit 5fa961b

Browse files
committed
Overhaul TyS and Ty.
Specifically, change `Ty` from this: ``` pub type Ty<'tcx> = &'tcx TyS<'tcx>; ``` to this ``` pub struct Ty<'tcx>(Interned<'tcx, TyS<'tcx>>); ``` There are two benefits to this. - It's now a first class type, so we can define methods on it. This means we can move a lot of methods away from `TyS`, leaving `TyS` as a barely-used type, which is appropriate given that it's not meant to be used directly. - The uniqueness requirement is now explicit, via the `Interned` type. E.g. the pointer-based `Eq` and `Hash` comes from `Interned`, rather than via `TyS`, which wasn't obvious at all. Much of this commit is boring churn. The interesting changes are in these files: - compiler/rustc_middle/src/arena.rs - compiler/rustc_middle/src/mir/visit.rs - compiler/rustc_middle/src/ty/context.rs - compiler/rustc_middle/src/ty/mod.rs Specifically: - Most mentions of `TyS` are removed. It's very much a dumb struct now; `Ty` has all the smarts. - `TyS` now has `crate` visibility instead of `pub`. - `TyS::make_for_test` is removed in favour of the static `BOOL_TY`, which just works better with the new structure. - The `Eq`/`Ord`/`Hash` impls are removed from `TyS`. `Interned`s impls of `Eq`/`Hash` now suffice. `Ord` is now partly on `Interned` (pointer-based, for the `Equal` case) and partly on `TyS` (contents-based, for the other cases). - There are many tedious sigil adjustments, i.e. adding or removing `*` or `&`. They seem to be unavoidable.
1 parent fecd216 commit 5fa961b

38 files changed

+78
-77
lines changed

clippy_lints/src/case_sensitive_file_extension_comparisons.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn check_case_sensitive_file_extension_comparison(ctx: &LateContext<'_>, expr: &
4747
then {
4848
let mut ty = ctx.typeck_results().expr_ty(obj);
4949
ty = match ty.kind() {
50-
ty::Ref(_, ty, ..) => ty,
50+
ty::Ref(_, ty, ..) => *ty,
5151
_ => ty
5252
};
5353

clippy_lints/src/default_numeric_fallback.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NumericFallbackVisitor<'a, 'tcx> {
123123
if let Some(fn_sig) = fn_sig_opt(self.cx, func.hir_id) {
124124
for (expr, bound) in iter::zip(*args, fn_sig.skip_binder().inputs()) {
125125
// Push found arg type, then visit arg.
126-
self.ty_bounds.push(TyBound::Ty(bound));
126+
self.ty_bounds.push(TyBound::Ty(*bound));
127127
self.visit_expr(expr);
128128
self.ty_bounds.pop();
129129
}
@@ -135,7 +135,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NumericFallbackVisitor<'a, 'tcx> {
135135
if let Some(def_id) = self.cx.typeck_results().type_dependent_def_id(expr.hir_id) {
136136
let fn_sig = self.cx.tcx.fn_sig(def_id).skip_binder();
137137
for (expr, bound) in iter::zip(*args, fn_sig.inputs()) {
138-
self.ty_bounds.push(TyBound::Ty(bound));
138+
self.ty_bounds.push(TyBound::Ty(*bound));
139139
self.visit_expr(expr);
140140
self.ty_bounds.pop();
141141
}
@@ -210,7 +210,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NumericFallbackVisitor<'a, 'tcx> {
210210

211211
fn fn_sig_opt<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Option<PolyFnSig<'tcx>> {
212212
let node_ty = cx.typeck_results().node_type_opt(hir_id)?;
213-
// We can't use `TyS::fn_sig` because it automatically performs substs, this may result in FNs.
213+
// We can't use `Ty::fn_sig` because it automatically performs substs, this may result in FNs.
214214
match node_ty.kind() {
215215
ty::FnDef(def_id, _) => Some(cx.tcx.fn_sig(*def_id)),
216216
ty::FnPtr(fn_sig) => Some(*fn_sig),

clippy_lints/src/eq_op.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use clippy_utils::{ast_utils::is_useless_with_eq_exprs, eq_expr_value, is_in_tes
77
use if_chain::if_chain;
88
use rustc_errors::Applicability;
99
use rustc_hir::{
10-
def::Res, def_id::DefId, BinOpKind, BorrowKind, Expr, ExprKind, GenericArg, ItemKind, QPath, Ty, TyKind,
10+
def::Res, def_id::DefId, BinOpKind, BorrowKind, Expr, ExprKind, GenericArg, ItemKind, QPath, TyKind,
1111
};
1212
use rustc_lint::{LateContext, LateLintPass};
13-
use rustc_middle::ty::{self, TyS};
13+
use rustc_middle::ty::{self, Ty};
1414
use rustc_session::{declare_lint_pass, declare_tool_lint};
1515

1616
declare_clippy_lint! {
@@ -279,7 +279,7 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
279279
}
280280
}
281281

282-
fn in_impl<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, bin_op: DefId) -> Option<(&'tcx Ty<'tcx>, &'tcx Ty<'tcx>)> {
282+
fn in_impl<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, bin_op: DefId) -> Option<(&'tcx rustc_hir::Ty<'tcx>, &'tcx rustc_hir::Ty<'tcx>)> {
283283
if_chain! {
284284
if let Some(block) = get_enclosing_block(cx, e.hir_id);
285285
if let Some(impl_def_id) = cx.tcx.impl_of_method(block.hir_id.owner.to_def_id());
@@ -301,7 +301,7 @@ fn in_impl<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, bin_op: DefId) -> Op
301301
}
302302
}
303303

304-
fn are_equal<'tcx>(cx: &LateContext<'tcx>, middle_ty: &TyS<'_>, hir_ty: &Ty<'_>) -> bool {
304+
fn are_equal<'tcx>(cx: &LateContext<'tcx>, middle_ty: Ty<'_>, hir_ty: &rustc_hir::Ty<'_>) -> bool {
305305
if_chain! {
306306
if let ty::Adt(adt_def, _) = middle_ty.kind();
307307
if let Some(local_did) = adt_def.did.as_local();

clippy_lints/src/format_args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ where
211211
if overloaded_deref.is_some() {
212212
n_needed = n_total;
213213
}
214-
ty = target;
214+
ty = *target;
215215
} else {
216216
return (n_needed, ty);
217217
}

clippy_lints/src/index_refutable_slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn find_slice_values(cx: &LateContext<'_>, pat: &hir::Pat<'_>) -> FxIndexMap<hir
118118
// The values need to use the `ref` keyword if they can't be copied.
119119
// This will need to be adjusted if the lint want to support multable access in the future
120120
let src_is_ref = bound_ty.is_ref() && binding != hir::BindingAnnotation::Ref;
121-
let needs_ref = !(src_is_ref || is_copy(cx, inner_ty));
121+
let needs_ref = !(src_is_ref || is_copy(cx, *inner_ty));
122122

123123
let slice_info = slices
124124
.entry(value_hir_id)

clippy_lints/src/large_const_arrays.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'tcx> LateLintPass<'tcx> for LargeConstArrays {
5555
if let ty::Array(element_type, cst) = ty.kind();
5656
if let ConstKind::Value(ConstValue::Scalar(element_count)) = cst.val;
5757
if let Ok(element_count) = element_count.to_machine_usize(&cx.tcx);
58-
if let Ok(element_size) = cx.layout_of(element_type).map(|l| l.size.bytes());
58+
if let Ok(element_size) = cx.layout_of(*element_type).map(|l| l.size.bytes());
5959
if self.maximum_allowed_size < element_count * element_size;
6060

6161
then {

clippy_lints/src/large_stack_arrays.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'tcx> LateLintPass<'tcx> for LargeStackArrays {
4545
if let ty::Array(element_type, cst) = cx.typeck_results().expr_ty(expr).kind();
4646
if let ConstKind::Value(ConstValue::Scalar(element_count)) = cst.val;
4747
if let Ok(element_count) = element_count.to_machine_usize(&cx.tcx);
48-
if let Ok(element_size) = cx.layout_of(element_type).map(|l| l.size.bytes());
48+
if let Ok(element_size) = cx.layout_of(*element_type).map(|l| l.size.bytes());
4949
if self.maximum_allowed_size < element_count * element_size;
5050
then {
5151
span_lint_and_help(

clippy_lints/src/len_zero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl LenOutput<'_> {
294294
/// Checks if the given signature matches the expectations for `is_empty`
295295
fn check_is_empty_sig(sig: FnSig<'_>, self_kind: ImplicitSelfKind, len_output: LenOutput<'_>) -> bool {
296296
match &**sig.inputs_and_output {
297-
[arg, res] if len_output.matches_is_empty_output(res) => {
297+
[arg, res] if len_output.matches_is_empty_output(*res) => {
298298
matches!(
299299
(arg.kind(), self_kind),
300300
(ty::Ref(_, _, Mutability::Not), ImplicitSelfKind::ImmRef)

clippy_lints/src/loops/explicit_counter_loop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_errors::Applicability;
77
use rustc_hir::intravisit::{walk_block, walk_expr};
88
use rustc_hir::{Expr, Pat};
99
use rustc_lint::LateContext;
10-
use rustc_middle::ty::{self, UintTy};
10+
use rustc_middle::ty::{self, Ty, UintTy};
1111

1212
// To trigger the EXPLICIT_COUNTER_LOOP lint, a variable must be
1313
// incremented exactly once in the loop body, and initialized to zero
@@ -36,7 +36,7 @@ pub(super) fn check<'tcx>(
3636
then {
3737
let mut applicability = Applicability::MachineApplicable;
3838

39-
let int_name = match ty.map(ty::TyS::kind) {
39+
let int_name = match ty.map(Ty::kind) {
4040
// usize or inferred
4141
Some(ty::Uint(UintTy::Usize)) | None => {
4242
span_lint_and_sugg(

clippy_lints/src/loops/manual_memcpy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ struct Start<'hir> {
335335
fn get_slice_like_element_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'tcx>> {
336336
match ty.kind() {
337337
ty::Adt(adt, subs) if cx.tcx.is_diagnostic_item(sym::Vec, adt.did) => Some(subs.type_at(0)),
338-
ty::Ref(_, subty, _) => get_slice_like_element_ty(cx, subty),
339-
ty::Slice(ty) | ty::Array(ty, _) => Some(ty),
338+
ty::Ref(_, subty, _) => get_slice_like_element_ty(cx, *subty),
339+
ty::Slice(ty) | ty::Array(ty, _) => Some(*ty),
340340
_ => None,
341341
}
342342
}

clippy_lints/src/loops/needless_collect.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_hir::{Block, Expr, ExprKind, HirId, HirIdSet, Local, Mutability, Node,
1212
use rustc_lint::LateContext;
1313
use rustc_middle::hir::nested_filter;
1414
use rustc_middle::ty::subst::GenericArgKind;
15-
use rustc_middle::ty::{self, TyS};
15+
use rustc_middle::ty::{self, Ty};
1616
use rustc_span::sym;
1717
use rustc_span::{MultiSpan, Span};
1818

@@ -334,8 +334,8 @@ fn detect_iter_and_into_iters<'tcx: 'a, 'a>(
334334
}
335335
}
336336

337-
fn get_captured_ids(cx: &LateContext<'_>, ty: &'_ TyS<'_>) -> HirIdSet {
338-
fn get_captured_ids_recursive(cx: &LateContext<'_>, ty: &'_ TyS<'_>, set: &mut HirIdSet) {
337+
fn get_captured_ids(cx: &LateContext<'_>, ty: Ty<'_>) -> HirIdSet {
338+
fn get_captured_ids_recursive(cx: &LateContext<'_>, ty: Ty<'_>, set: &mut HirIdSet) {
339339
match ty.kind() {
340340
ty::Adt(_, generics) => {
341341
for generic in *generics {

clippy_lints/src/loops/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ pub(super) fn make_iterator_snippet(cx: &LateContext<'_>, arg: &Expr<'_>, applic
334334
// (&mut x).into_iter() ==> x.iter_mut()
335335
let arg_ty = cx.typeck_results().expr_ty_adjusted(arg);
336336
match &arg_ty.kind() {
337-
ty::Ref(_, inner_ty, mutbl) if has_iter_method(cx, inner_ty).is_some() => {
337+
ty::Ref(_, inner_ty, mutbl) if has_iter_method(cx, *inner_ty).is_some() => {
338338
let method_name = match mutbl {
339339
Mutability::Mut => "iter_mut",
340340
Mutability::Not => "iter",

clippy_lints/src/map_clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'tcx> LateLintPass<'tcx> for MapClone {
100100
let obj_ty = cx.typeck_results().expr_ty(obj);
101101
if let ty::Ref(_, ty, mutability) = obj_ty.kind() {
102102
if matches!(mutability, Mutability::Not) {
103-
let copy = is_copy(cx, ty);
103+
let copy = is_copy(cx, *ty);
104104
self.lint_explicit_closure(cx, e.span, args[0].span, copy);
105105
}
106106
} else {

clippy_lints/src/matches/redundant_pattern_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn type_needs_ordered_drop_inner<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, see
5959
// Check if any component type has any.
6060
match ty.kind() {
6161
ty::Tuple(_) => ty.tuple_fields().any(|ty| type_needs_ordered_drop_inner(cx, ty, seen)),
62-
ty::Array(ty, _) => type_needs_ordered_drop_inner(cx, ty, seen),
62+
ty::Array(ty, _) => type_needs_ordered_drop_inner(cx, *ty, seen),
6363
ty::Adt(adt, subs) => adt
6464
.all_fields()
6565
.map(|f| f.ty(cx.tcx, subs))

clippy_lints/src/matches/single_match.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use core::cmp::max;
88
use rustc_errors::Applicability;
99
use rustc_hir::{Arm, BindingAnnotation, Block, Expr, ExprKind, Pat, PatKind};
1010
use rustc_lint::LateContext;
11-
use rustc_middle::ty::{self, Ty, TyS};
11+
use rustc_middle::ty::{self, Ty};
1212

1313
use super::{MATCH_BOOL, SINGLE_MATCH, SINGLE_MATCH_ELSE};
1414

@@ -162,10 +162,10 @@ fn check_opt_like<'a>(
162162
return;
163163
}
164164

165-
let in_candidate_enum = |path_info: &(String, &TyS<'_>)| -> bool {
165+
let in_candidate_enum = |path_info: &(String, Ty<'_>)| -> bool {
166166
let (path, ty) = path_info;
167167
for &(ty_path, pat_path) in candidates {
168-
if path == pat_path && match_type(cx, ty, ty_path) {
168+
if path == pat_path && match_type(cx, *ty, ty_path) {
169169
return true;
170170
}
171171
}

clippy_lints/src/methods/cloned_instead_of_copied.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, span: Span,
3030
};
3131
match inner_ty.kind() {
3232
// &T where T: Copy
33-
ty::Ref(_, ty, _) if is_copy(cx, ty) => {},
33+
ty::Ref(_, ty, _) if is_copy(cx, *ty) => {},
3434
_ => return,
3535
};
3636
span_lint_and_sugg(

clippy_lints/src/methods/iter_overeager_cloned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(super) fn check<'tcx>(
2626
};
2727

2828
match inner_ty.kind() {
29-
ty::Ref(_, ty, _) if !is_copy(cx, ty) => {},
29+
ty::Ref(_, ty, _) if !is_copy(cx, *ty) => {},
3030
_ => return,
3131
};
3232

clippy_lints/src/methods/manual_str_repeat.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_ast::LitKind;
88
use rustc_errors::Applicability;
99
use rustc_hir::{Expr, ExprKind, LangItem};
1010
use rustc_lint::LateContext;
11-
use rustc_middle::ty::{self, Ty, TyS};
11+
use rustc_middle::ty::{self, Ty};
1212
use rustc_span::symbol::sym;
1313
use std::borrow::Cow;
1414

@@ -37,8 +37,8 @@ fn parse_repeat_arg(cx: &LateContext<'_>, e: &Expr<'_>) -> Option<RepeatKind> {
3737
} else {
3838
let ty = cx.typeck_results().expr_ty(e);
3939
if is_type_diagnostic_item(cx, ty, sym::String)
40-
|| (is_type_lang_item(cx, ty, LangItem::OwnedBox) && get_ty_param(ty).map_or(false, TyS::is_str))
41-
|| (match_type(cx, ty, &paths::COW) && get_ty_param(ty).map_or(false, TyS::is_str))
40+
|| (is_type_lang_item(cx, ty, LangItem::OwnedBox) && get_ty_param(ty).map_or(false, Ty::is_str))
41+
|| (match_type(cx, ty, &paths::COW) && get_ty_param(ty).map_or(false, Ty::is_str))
4242
{
4343
Some(RepeatKind::String)
4444
} else {

clippy_lints/src/methods/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,7 +2106,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
21062106
let method_sig = cx.tcx.fn_sig(impl_item.def_id);
21072107
let method_sig = cx.tcx.erase_late_bound_regions(method_sig);
21082108

2109-
let first_arg_ty = &method_sig.inputs().iter().next();
2109+
let first_arg_ty = method_sig.inputs().iter().next();
21102110

21112111
// check conventions w.r.t. conversion method names and predicates
21122112
if let Some(first_arg_ty) = first_arg_ty;
@@ -2119,7 +2119,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
21192119
if name == method_config.method_name &&
21202120
sig.decl.inputs.len() == method_config.param_count &&
21212121
method_config.output_type.matches(&sig.decl.output) &&
2122-
method_config.self_kind.matches(cx, self_ty, first_arg_ty) &&
2122+
method_config.self_kind.matches(cx, self_ty, *first_arg_ty) &&
21232123
fn_header_equals(method_config.fn_header, sig.header) &&
21242124
method_config.lifetime_param_cond(impl_item)
21252125
{
@@ -2151,7 +2151,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
21512151
cx,
21522152
name,
21532153
self_ty,
2154-
first_arg_ty,
2154+
*first_arg_ty,
21552155
first_arg.pat.span,
21562156
implements_trait,
21572157
false

clippy_lints/src/methods/unnecessary_to_owned.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn check_addr_of_expr(
105105
if is_copy(cx, receiver_ty) || is_cow_into_owned(cx, method_name, method_def_id);
106106
if let Some(receiver_snippet) = snippet_opt(cx, receiver.span);
107107
then {
108-
let (target_ty, n_target_refs) = peel_mid_ty_refs(target_ty);
108+
let (target_ty, n_target_refs) = peel_mid_ty_refs(*target_ty);
109109
let (receiver_ty, n_receiver_refs) = peel_mid_ty_refs(receiver_ty);
110110
if receiver_ty == target_ty && n_target_refs >= n_receiver_refs {
111111
span_lint_and_sugg(
@@ -228,7 +228,7 @@ fn check_other_call_arg<'tcx>(
228228
let fn_sig = cx.tcx.fn_sig(callee_def_id).skip_binder();
229229
if let Some(i) = call_args.iter().position(|arg| arg.hir_id == maybe_arg.hir_id);
230230
if let Some(input) = fn_sig.inputs().get(i);
231-
let (input, n_refs) = peel_mid_ty_refs(input);
231+
let (input, n_refs) = peel_mid_ty_refs(*input);
232232
if let (trait_predicates, projection_predicates) = get_input_traits_and_projections(cx, callee_def_id, input);
233233
if let Some(sized_def_id) = cx.tcx.lang_items().sized_trait();
234234
if let [trait_predicate] = trait_predicates

clippy_lints/src/methods/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub(super) fn derefs_to_slice<'tcx>(
1919
ty::Adt(def, _) if def.is_box() => may_slice(cx, ty.boxed_ty()),
2020
ty::Adt(..) => is_type_diagnostic_item(cx, ty, sym::Vec),
2121
ty::Array(_, size) => size.try_eval_usize(cx.tcx, cx.param_env).is_some(),
22-
ty::Ref(_, inner, _) => may_slice(cx, inner),
22+
ty::Ref(_, inner, _) => may_slice(cx, *inner),
2323
_ => false,
2424
}
2525
}
@@ -35,7 +35,7 @@ pub(super) fn derefs_to_slice<'tcx>(
3535
ty::Slice(_) => Some(expr),
3636
ty::Adt(def, _) if def.is_box() && may_slice(cx, ty.boxed_ty()) => Some(expr),
3737
ty::Ref(_, inner, _) => {
38-
if may_slice(cx, inner) {
38+
if may_slice(cx, *inner) {
3939
Some(expr)
4040
} else {
4141
None

clippy_lints/src/methods/wrong_self_convention.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::methods::SelfKind;
22
use clippy_utils::diagnostics::span_lint_and_help;
33
use clippy_utils::ty::is_copy;
44
use rustc_lint::LateContext;
5-
use rustc_middle::ty::TyS;
5+
use rustc_middle::ty::Ty;
66
use rustc_span::source_map::Span;
77
use std::fmt;
88

@@ -41,7 +41,7 @@ impl Convention {
4141
fn check<'tcx>(
4242
&self,
4343
cx: &LateContext<'tcx>,
44-
self_ty: &'tcx TyS<'tcx>,
44+
self_ty: Ty<'tcx>,
4545
other: &str,
4646
implements_trait: bool,
4747
is_trait_item: bool,
@@ -84,8 +84,8 @@ impl fmt::Display for Convention {
8484
pub(super) fn check<'tcx>(
8585
cx: &LateContext<'tcx>,
8686
item_name: &str,
87-
self_ty: &'tcx TyS<'tcx>,
88-
first_arg_ty: &'tcx TyS<'tcx>,
87+
self_ty: Ty<'tcx>,
88+
first_arg_ty: Ty<'tcx>,
8989
first_arg_span: Span,
9090
implements_trait: bool,
9191
is_trait_item: bool,

clippy_lints/src/methods/zst_offset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use super::ZST_OFFSET;
99
pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>) {
1010
if_chain! {
1111
if let ty::RawPtr(ty::TypeAndMut { ty, .. }) = cx.typeck_results().expr_ty(recv).kind();
12-
if let Ok(layout) = cx.tcx.layout_of(cx.param_env.and(ty));
12+
if let Ok(layout) = cx.tcx.layout_of(cx.param_env.and(*ty));
1313
if layout.is_zst();
1414
then {
1515
span_lint(cx, ZST_OFFSET, expr.span, "offset calculation on zero-sized value");

clippy_lints/src/modulo_arithmetic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clippy_utils::sext;
44
use if_chain::if_chain;
55
use rustc_hir::{BinOpKind, Expr, ExprKind};
66
use rustc_lint::{LateContext, LateLintPass};
7-
use rustc_middle::ty;
7+
use rustc_middle::ty::{self, Ty};
88
use rustc_session::{declare_lint_pass, declare_tool_lint};
99
use std::fmt::Display;
1010

@@ -77,7 +77,7 @@ fn floating_point_operand_info<T: Display + PartialOrd + From<f32>>(f: &T) -> Op
7777
}
7878
}
7979

80-
fn might_have_negative_value(t: &ty::TyS<'_>) -> bool {
80+
fn might_have_negative_value(t: Ty<'_>) -> bool {
8181
t.is_signed() || t.is_floating_point()
8282
}
8383

clippy_lints/src/mut_key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fn check_sig<'tcx>(cx: &LateContext<'tcx>, item_hir_id: hir::HirId, decl: &hir::
113113
let fn_def_id = cx.tcx.hir().local_def_id(item_hir_id);
114114
let fn_sig = cx.tcx.fn_sig(fn_def_id);
115115
for (hir_ty, ty) in iter::zip(decl.inputs, fn_sig.inputs().skip_binder()) {
116-
check_ty(cx, hir_ty.span, ty);
116+
check_ty(cx, hir_ty.span, *ty);
117117
}
118118
check_ty(cx, decl.output.span(), cx.tcx.erase_late_bound_regions(fn_sig.output()));
119119
}

clippy_lints/src/mut_mutex_lock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<'tcx> LateLintPass<'tcx> for MutMutexLock {
5353
if path.ident.name == sym!(lock);
5454
let ty = cx.typeck_results().expr_ty(self_arg);
5555
if let ty::Ref(_, inner_ty, Mutability::Mut) = ty.kind();
56-
if is_type_diagnostic_item(cx, inner_ty, sym::Mutex);
56+
if is_type_diagnostic_item(cx, *inner_ty, sym::Mutex);
5757
then {
5858
span_lint_and_sugg(
5959
cx,

clippy_lints/src/non_send_fields_in_send_ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ fn ty_allowed_with_raw_pointer_heuristic<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'t
205205
ty::Tuple(_) => ty
206206
.tuple_fields()
207207
.all(|ty| ty_allowed_with_raw_pointer_heuristic(cx, ty, send_trait)),
208-
ty::Array(ty, _) | ty::Slice(ty) => ty_allowed_with_raw_pointer_heuristic(cx, ty, send_trait),
208+
ty::Array(ty, _) | ty::Slice(ty) => ty_allowed_with_raw_pointer_heuristic(cx, *ty, send_trait),
209209
ty::Adt(_, substs) => {
210210
if contains_pointer_like(cx, ty) {
211211
// descends only if ADT contains any raw pointers

0 commit comments

Comments
 (0)