Skip to content

Commit 7b2896a

Browse files
committed
Auto merge of #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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

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: 8 additions & 6 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

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: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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(

0 commit comments

Comments
 (0)