Skip to content

Commit 5458358

Browse files
committed
Auto merge of rust-lang#7644 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents f356784 + 563a00b commit 5458358

19 files changed

+20
-57
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.56"
3+
version = "0.1.57"
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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
# begin automatic update
4-
version = "0.1.56"
5-
# end automatic update
3+
version = "0.1.57"
64
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
75
repository = "https://github.com/rust-lang/rust-clippy"
86
readme = "README.md"

clippy_lints/src/casts/cast_ptr_alignment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use clippy_utils::is_hir_ty_cfg_dependant;
33
use if_chain::if_chain;
44
use rustc_hir::{Expr, ExprKind, GenericArg};
55
use rustc_lint::LateContext;
6+
use rustc_middle::ty::layout::LayoutOf;
67
use rustc_middle::ty::{self, Ty};
78
use rustc_span::symbol::sym;
8-
use rustc_target::abi::LayoutOf;
99

1010
use super::CAST_PTR_ALIGNMENT;
1111

clippy_lints/src/escape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use rustc_hir::{self, AssocItemKind, Body, FnDecl, HirId, HirIdSet, Impl, ItemKi
55
use rustc_infer::infer::TyCtxtInferExt;
66
use rustc_lint::{LateContext, LateLintPass};
77
use rustc_middle::mir::FakeReadCause;
8+
use rustc_middle::ty::layout::LayoutOf;
89
use rustc_middle::ty::{self, TraitRef, Ty};
910
use rustc_session::{declare_tool_lint, impl_lint_pass};
1011
use rustc_span::source_map::Span;
1112
use rustc_span::symbol::kw;
12-
use rustc_target::abi::LayoutOf;
1313
use rustc_target::spec::abi::Abi;
1414
use rustc_typeck::expr_use_visitor::{Delegate, ExprUseVisitor, PlaceBase, PlaceWithHirId};
1515

clippy_lints/src/invalid_upcast_comparisons.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use std::cmp::Ordering;
22

33
use rustc_hir::{Expr, ExprKind};
44
use rustc_lint::{LateContext, LateLintPass};
5+
use rustc_middle::ty::layout::LayoutOf;
56
use rustc_middle::ty::{self, IntTy, UintTy};
67
use rustc_session::{declare_lint_pass, declare_tool_lint};
78
use rustc_span::Span;
8-
use rustc_target::abi::LayoutOf;
99

1010
use clippy_utils::comparisons::Rel;
1111
use clippy_utils::consts::{constant, Constant};

clippy_lints/src/large_const_arrays.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use crate::rustc_target::abi::LayoutOf;
21
use clippy_utils::diagnostics::span_lint_and_then;
32
use if_chain::if_chain;
43
use rustc_errors::Applicability;
54
use rustc_hir::{Item, ItemKind};
65
use rustc_lint::{LateContext, LateLintPass};
76
use rustc_middle::mir::interpret::ConstValue;
7+
use rustc_middle::ty::layout::LayoutOf;
88
use rustc_middle::ty::{self, ConstKind};
99
use rustc_session::{declare_tool_lint, impl_lint_pass};
1010
use rustc_span::{BytePos, Pos, Span};

clippy_lints/src/large_enum_variant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use rustc_errors::Applicability;
66
use rustc_hir::{Item, ItemKind, VariantData};
77
use rustc_lint::{LateContext, LateLintPass};
88
use rustc_middle::lint::in_external_macro;
9+
use rustc_middle::ty::layout::LayoutOf;
910
use rustc_session::{declare_tool_lint, impl_lint_pass};
10-
use rustc_target::abi::LayoutOf;
1111

1212
declare_clippy_lint! {
1313
/// ### What it does

clippy_lints/src/large_stack_arrays.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ use if_chain::if_chain;
44
use rustc_hir::{Expr, ExprKind};
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_middle::mir::interpret::ConstValue;
7+
use rustc_middle::ty::layout::LayoutOf;
78
use rustc_middle::ty::{self, ConstKind};
89
use rustc_session::{declare_tool_lint, impl_lint_pass};
910

10-
use crate::rustc_target::abi::LayoutOf;
11-
1211
declare_clippy_lint! {
1312
/// ### What it does
1413
/// Checks for local arrays that may be too large.

clippy_lints/src/macro_use.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,8 @@ pub struct MacroRefData {
4747

4848
impl MacroRefData {
4949
pub fn new(name: String, callee: Span, cx: &LateContext<'_>) -> Self {
50-
let mut path = cx
51-
.sess()
52-
.source_map()
53-
.span_to_filename(callee)
54-
.prefer_local()
55-
.to_string();
50+
let sm = cx.sess().source_map();
51+
let mut path = sm.filename_for_diagnostics(&sm.span_to_filename(callee)).to_string();
5652

5753
// std lib paths are <::std::module::file type>
5854
// so remove brackets, space and type.

clippy_lints/src/methods/manual_saturating_arithmetic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_ast::ast;
66
use rustc_errors::Applicability;
77
use rustc_hir as hir;
88
use rustc_lint::LateContext;
9-
use rustc_target::abi::LayoutOf;
9+
use rustc_middle::ty::layout::LayoutOf;
1010

1111
pub fn check(
1212
cx: &LateContext<'_>,

clippy_lints/src/pass_by_ref_or_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ use rustc_hir::intravisit::FnKind;
1313
use rustc_hir::{BindingAnnotation, Body, FnDecl, HirId, Impl, ItemKind, MutTy, Mutability, Node, PatKind};
1414
use rustc_lint::{LateContext, LateLintPass};
1515
use rustc_middle::ty;
16+
use rustc_middle::ty::layout::LayoutOf;
1617
use rustc_session::{declare_tool_lint, impl_lint_pass};
1718
use rustc_span::def_id::LocalDefId;
1819
use rustc_span::{sym, Span};
19-
use rustc_target::abi::LayoutOf;
2020
use rustc_target::spec::abi::Abi;
2121
use rustc_target::spec::Target;
2222

clippy_lints/src/types/vec_box.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use if_chain::if_chain;
55
use rustc_errors::Applicability;
66
use rustc_hir::{self as hir, def_id::DefId, GenericArg, QPath, TyKind};
77
use rustc_lint::LateContext;
8+
use rustc_middle::ty::layout::LayoutOf;
89
use rustc_middle::ty::TypeFoldable;
910
use rustc_span::symbol::sym;
10-
use rustc_target::abi::LayoutOf;
1111
use rustc_typeck::hir_ty_to_ty;
1212

1313
use super::VEC_BOX;

clippy_lints/src/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::rustc_target::abi::LayoutOf;
21
use clippy_utils::consts::{constant, Constant};
32
use clippy_utils::diagnostics::span_lint_and_sugg;
43
use clippy_utils::higher;
@@ -8,6 +7,7 @@ use if_chain::if_chain;
87
use rustc_errors::Applicability;
98
use rustc_hir::{BorrowKind, Expr, ExprKind, Mutability};
109
use rustc_lint::{LateContext, LateLintPass};
10+
use rustc_middle::ty::layout::LayoutOf;
1111
use rustc_middle::ty::{self, Ty};
1212
use rustc_session::{declare_tool_lint, impl_lint_pass};
1313
use rustc_span::source_map::Span;

clippy_lints/src/zero_sized_map_values.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use clippy_utils::ty::{is_normalizable, is_type_diagnostic_item};
33
use if_chain::if_chain;
44
use rustc_hir::{self as hir, HirId, ItemKind, Node};
55
use rustc_lint::{LateContext, LateLintPass};
6+
use rustc_middle::ty::layout::LayoutOf as _;
67
use rustc_middle::ty::{Adt, Ty, TypeFoldable};
78
use rustc_session::{declare_lint_pass, declare_tool_lint};
89
use rustc_span::sym;
9-
use rustc_target::abi::LayoutOf as _;
1010
use rustc_typeck::hir_ty_to_ty;
1111

1212
declare_clippy_lint! {

clippy_utils/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_utils"
3-
version = "0.1.56"
3+
version = "0.1.57"
44
edition = "2018"
55
publish = false
66

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2021-09-02"
2+
channel = "nightly-2021-09-08"
33
components = ["llvm-tools-preview", "rustc-dev", "rust-src"]

tests/ui/match_same_arms.stderr

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,6 @@ LL | 1 => 2,
106106
| ^
107107
= help: ...or consider changing the match arm bodies
108108

109-
error: this `match` has identical arm bodies
110-
--> $DIR/match_same_arms.rs:33:14
111-
|
112-
LL | 3 => 2, //~ ERROR 3rd matched arms have same body
113-
| ^
114-
|
115-
note: same as this
116-
--> $DIR/match_same_arms.rs:32:14
117-
|
118-
LL | 2 => 2, //~ ERROR 2nd matched arms have same body
119-
| ^
120-
help: consider refactoring into `2 | 3`
121-
--> $DIR/match_same_arms.rs:32:9
122-
|
123-
LL | 2 => 2, //~ ERROR 2nd matched arms have same body
124-
| ^
125-
= help: ...or consider changing the match arm bodies
126-
127109
error: this `match` has identical arm bodies
128110
--> $DIR/match_same_arms.rs:50:55
129111
|
@@ -142,5 +124,5 @@ LL | CommandInfo::BuiltIn { name, .. } => name.to_string(),
142124
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
143125
= help: ...or consider changing the match arm bodies
144126

145-
error: aborting due to 8 previous errors
127+
error: aborting due to 7 previous errors
146128

tests/ui/modulo_one.stderr

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ LL | const ONE: u32 = 1 * 1;
4646
|
4747
= note: `-D clippy::identity-op` implied by `-D warnings`
4848

49-
error: the operation is ineffective. Consider reducing it to `1`
50-
--> $DIR/modulo_one.rs:13:22
51-
|
52-
LL | const ONE: u32 = 1 * 1;
53-
| ^^^^^
54-
5549
error: any number modulo 1 will be 0
5650
--> $DIR/modulo_one.rs:17:5
5751
|
@@ -70,5 +64,5 @@ error: any number modulo -1 will panic/overflow or result in 0
7064
LL | INT_MIN % NEG_ONE; // also caught by rustc
7165
| ^^^^^^^^^^^^^^^^^
7266

73-
error: aborting due to 11 previous errors
67+
error: aborting due to 10 previous errors
7468

tests/ui/suspicious_operation_groupings.stderr

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ LL | self.x == other.y && self.y == other.y && self.z == other.z
66
|
77
= note: `-D clippy::suspicious-operation-groupings` implied by `-D warnings`
88

9-
error: this sequence of operators looks suspiciously like a bug
10-
--> $DIR/suspicious_operation_groupings.rs:14:9
11-
|
12-
LL | self.x == other.y && self.y == other.y && self.z == other.z
13-
| ^^^^^^^^^^^^^^^^^ help: did you mean: `self.x == other.x`
14-
159
error: this sequence of operators looks suspiciously like a bug
1610
--> $DIR/suspicious_operation_groupings.rs:27:20
1711
|
@@ -162,5 +156,5 @@ error: this sequence of operators looks suspiciously like a bug
162156
LL | -(if -s1.a < -s2.a && -s1.a < -s2.b { s1.c } else { s2.a })
163157
| ^^^^^^^^^^^^^ help: did you mean: `-s1.b < -s2.b`
164158

165-
error: aborting due to 27 previous errors
159+
error: aborting due to 26 previous errors
166160

0 commit comments

Comments
 (0)