Skip to content

Commit 7b2896a

Browse files
committed
Auto merge of rust-lang#8468 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 042892a + ce1904f commit 7b2896a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+143
-137
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.60"
3+
version = "0.1.61"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.1.60"
3+
version = "0.1.61"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/src/case_sensitive_file_extension_comparisons.rs

+1-1
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

+3-3
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

+8-6
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ use clippy_utils::ty::{implements_trait, is_copy};
66
use clippy_utils::{ast_utils::is_useless_with_eq_exprs, eq_expr_value, is_in_test_function};
77
use if_chain::if_chain;
88
use rustc_errors::Applicability;
9-
use rustc_hir::{
10-
def::Res, def_id::DefId, BinOpKind, BorrowKind, Expr, ExprKind, GenericArg, ItemKind, QPath, Ty, TyKind,
11-
};
9+
use rustc_hir::{def::Res, def_id::DefId, BinOpKind, BorrowKind, Expr, ExprKind, GenericArg, ItemKind, QPath, TyKind};
1210
use rustc_lint::{LateContext, LateLintPass};
13-
use rustc_middle::ty::{self, TyS};
11+
use rustc_middle::ty::{self, Ty};
1412
use rustc_session::{declare_lint_pass, declare_tool_lint};
1513

1614
declare_clippy_lint! {
@@ -279,7 +277,11 @@ impl<'tcx> LateLintPass<'tcx> for EqOp {
279277
}
280278
}
281279

282-
fn in_impl<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, bin_op: DefId) -> Option<(&'tcx Ty<'tcx>, &'tcx Ty<'tcx>)> {
280+
fn in_impl<'tcx>(
281+
cx: &LateContext<'tcx>,
282+
e: &'tcx Expr<'_>,
283+
bin_op: DefId,
284+
) -> Option<(&'tcx rustc_hir::Ty<'tcx>, &'tcx rustc_hir::Ty<'tcx>)> {
283285
if_chain! {
284286
if let Some(block) = get_enclosing_block(cx, e.hir_id);
285287
if let Some(impl_def_id) = cx.tcx.impl_of_method(block.hir_id.owner.to_def_id());
@@ -301,7 +303,7 @@ fn in_impl<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, bin_op: DefId) -> Op
301303
}
302304
}
303305

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

clippy_lints/src/format_args.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ where
191191
if overloaded_deref.is_some() {
192192
n_needed = n_total;
193193
}
194-
ty = target;
194+
ty = *target;
195195
} else {
196196
return (n_needed, ty);
197197
}

clippy_lints/src/functions/must_use.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ fn is_mutable_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, span: Span, tys: &m
193193
|| KNOWN_WRAPPER_TYS.iter().any(|path| match_def_path(cx, adt.did, path))
194194
&& substs.types().any(|ty| is_mutable_ty(cx, ty, span, tys))
195195
},
196-
ty::Tuple(substs) => substs.types().any(|ty| is_mutable_ty(cx, ty, span, tys)),
196+
ty::Tuple(substs) => substs.iter().any(|ty| is_mutable_ty(cx, ty, span, tys)),
197197
ty::Array(ty, _) | ty::Slice(ty) => is_mutable_ty(cx, ty, span, tys),
198198
ty::RawPtr(ty::TypeAndMut { ty, mutbl }) | ty::Ref(_, ty, mutbl) => {
199199
mutbl == hir::Mutability::Mut || is_mutable_ty(cx, ty, span, tys)

clippy_lints/src/index_refutable_slice.rs

+1-1
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ impl<'tcx> LateLintPass<'tcx> for LargeConstArrays {
5353
if let ItemKind::Const(hir_ty, _) = &item.kind;
5454
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
5555
if let ty::Array(element_type, cst) = ty.kind();
56-
if let ConstKind::Value(ConstValue::Scalar(element_count)) = cst.val;
56+
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ impl<'tcx> LateLintPass<'tcx> for LargeStackArrays {
4343
if_chain! {
4444
if let ExprKind::Repeat(_, _) = expr.kind;
4545
if let ty::Array(element_type, cst) = cx.typeck_results().expr_ty(expr).kind();
46-
if let ConstKind::Value(ConstValue::Scalar(element_count)) = cst.val;
46+
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

+1-1
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

+2-2
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

+2-2
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

+3-3
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

+1-1
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

+1-1
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ fn type_needs_ordered_drop_inner<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, see
5454
// This type doesn't implement drop, so no side effects here.
5555
// Check if any component type has any.
5656
match ty.kind() {
57-
ty::Tuple(_) => ty.tuple_fields().any(|ty| type_needs_ordered_drop_inner(cx, ty, seen)),
58-
ty::Array(ty, _) => type_needs_ordered_drop_inner(cx, ty, seen),
57+
ty::Tuple(fields) => fields.iter().any(|ty| type_needs_ordered_drop_inner(cx, ty, seen)),
58+
ty::Array(ty, _) => type_needs_ordered_drop_inner(cx, *ty, seen),
5959
ty::Adt(adt, subs) => adt
6060
.all_fields()
6161
.map(|f| f.ty(cx.tcx, subs))

clippy_lints/src/matches/single_match.rs

+3-3
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

+1-1
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/expect_fun_call.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub(super) fn check<'tcx>(
7373
match cx.qpath_res(p, fun.hir_id) {
7474
hir::def::Res::Def(hir::def::DefKind::Fn | hir::def::DefKind::AssocFn, def_id) => matches!(
7575
cx.tcx.fn_sig(def_id).output().skip_binder().kind(),
76-
ty::Ref(ty::ReStatic, ..)
76+
ty::Ref(re, ..) if re.is_static(),
7777
),
7878
_ => false,
7979
}
@@ -87,7 +87,7 @@ pub(super) fn check<'tcx>(
8787
.map_or(false, |method_id| {
8888
matches!(
8989
cx.tcx.fn_sig(method_id).output().skip_binder().kind(),
90-
ty::Ref(ty::ReStatic, ..)
90+
ty::Ref(re, ..) if re.is_static()
9191
)
9292
})
9393
},

clippy_lints/src/methods/iter_overeager_cloned.rs

+1-1
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

+3-3
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

+3-3
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

+2-2
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

+2-2
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

+4-4
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,

0 commit comments

Comments
 (0)