Skip to content

Commit ac0e10a

Browse files
committed
Auto merge of #9596 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 887ba0c + ad1814d commit ac0e10a

File tree

220 files changed

+276
-284
lines changed

Some content is hidden

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

220 files changed

+276
-284
lines changed

clippy_lints/src/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ fn ty_auto_deref_stability<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, precedenc
12591259
ty::Adt(..) if ty.has_placeholders() || ty.has_opaque_types() => {
12601260
Position::ReborrowStable(precedence).into()
12611261
},
1262-
ty::Adt(_, substs) if substs.has_param_types_or_consts() => {
1262+
ty::Adt(_, substs) if substs.has_non_region_param() => {
12631263
TyPosition::new_deref_stable_for_result(precedence, ty)
12641264
},
12651265
ty::Bool

clippy_lints/src/module_style.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,8 @@ impl EarlyLintPass for ModStyle {
117117
cx.struct_span_lint(
118118
SELF_NAMED_MODULE_FILES,
119119
Span::new(file.start_pos, file.start_pos, SyntaxContext::root(), None),
120-
|build| {
121-
let mut lint =
122-
build.build(&format!("`mod.rs` files are required, found `{}`", path.display()));
123-
lint.help(&format!("move `{}` to `{}`", path.display(), correct.display(),));
124-
lint.emit();
125-
},
120+
format!("`mod.rs` files are required, found `{}`", path.display()),
121+
|lint| lint.help(format!("move `{}` to `{}`", path.display(), correct.display(),)),
126122
);
127123
}
128124
}
@@ -156,11 +152,8 @@ fn check_self_named_mod_exists(cx: &EarlyContext<'_>, path: &Path, file: &Source
156152
cx.struct_span_lint(
157153
MOD_MODULE_FILES,
158154
Span::new(file.start_pos, file.start_pos, SyntaxContext::root(), None),
159-
|build| {
160-
let mut lint = build.build(&format!("`mod.rs` files are not allowed, found `{}`", path.display()));
161-
lint.help(&format!("move `{}` to `{}`", path.display(), mod_file.display(),));
162-
lint.emit();
163-
},
155+
format!("`mod.rs` files are not allowed, found `{}`", path.display()),
156+
|lint| lint.help(format!("move `{}` to `{}`", path.display(), mod_file.display())),
164157
);
165158
}
166159
}

clippy_lints/src/trait_bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<'tcx> LateLintPass<'tcx> for TraitBounds {
128128
if !bound_predicate.span.from_expansion();
129129
if let TyKind::Path(QPath::Resolved(_, Path { segments, .. })) = bound_predicate.bounded_ty.kind;
130130
if let Some(PathSegment {
131-
res: Res::SelfTy{ trait_: Some(def_id), alias_to: _ }, ..
131+
res: Res::SelfTyParam { trait_: def_id }, ..
132132
}) = segments.first();
133133
if let Some(
134134
Node::Item(

clippy_lints/src/use_self.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,12 @@ impl<'tcx> LateLintPass<'tcx> for UseSelf {
206206
ref types_to_skip,
207207
}) = self.stack.last();
208208
if let TyKind::Path(QPath::Resolved(_, path)) = hir_ty.kind;
209-
if !matches!(path.res, Res::SelfTy { .. } | Res::Def(DefKind::TyParam, _));
209+
if !matches!(
210+
path.res,
211+
Res::SelfTyParam { .. }
212+
| Res::SelfTyAlias { .. }
213+
| Res::Def(DefKind::TyParam, _)
214+
);
210215
if !types_to_skip.contains(&hir_ty.hir_id);
211216
let ty = if in_body > 0 {
212217
cx.typeck_results().node_type(hir_ty.hir_id)
@@ -230,7 +235,7 @@ impl<'tcx> LateLintPass<'tcx> for UseSelf {
230235
}
231236
match expr.kind {
232237
ExprKind::Struct(QPath::Resolved(_, path), ..) => match path.res {
233-
Res::SelfTy { .. } => (),
238+
Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } => (),
234239
Res::Def(DefKind::Variant, _) => lint_path_to_variant(cx, path),
235240
_ => span_lint(cx, path.span),
236241
},

clippy_utils/src/diagnostics.rs

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ fn docs_link(diag: &mut Diagnostic, lint: &'static Lint) {
4646
/// | ^^^^^^^^^^^^^^^^^^^^^^^
4747
/// ```
4848
pub fn span_lint<T: LintContext>(cx: &T, lint: &'static Lint, sp: impl Into<MultiSpan>, msg: &str) {
49-
cx.struct_span_lint(lint, sp, |diag| {
50-
let mut diag = diag.build(msg);
51-
docs_link(&mut diag, lint);
52-
diag.emit();
49+
cx.struct_span_lint(lint, sp, msg, |diag| {
50+
docs_link(diag, lint);
51+
diag
5352
});
5453
}
5554

@@ -81,15 +80,14 @@ pub fn span_lint_and_help<'a, T: LintContext>(
8180
help_span: Option<Span>,
8281
help: &str,
8382
) {
84-
cx.struct_span_lint(lint, span, |diag| {
85-
let mut diag = diag.build(msg);
83+
cx.struct_span_lint(lint, span, msg, |diag| {
8684
if let Some(help_span) = help_span {
8785
diag.span_help(help_span, help);
8886
} else {
8987
diag.help(help);
9088
}
91-
docs_link(&mut diag, lint);
92-
diag.emit();
89+
docs_link(diag, lint);
90+
diag
9391
});
9492
}
9593

@@ -124,15 +122,14 @@ pub fn span_lint_and_note<'a, T: LintContext>(
124122
note_span: Option<Span>,
125123
note: &str,
126124
) {
127-
cx.struct_span_lint(lint, span, |diag| {
128-
let mut diag = diag.build(msg);
125+
cx.struct_span_lint(lint, span, msg, |diag| {
129126
if let Some(note_span) = note_span {
130127
diag.span_note(note_span, note);
131128
} else {
132129
diag.note(note);
133130
}
134-
docs_link(&mut diag, lint);
135-
diag.emit();
131+
docs_link(diag, lint);
132+
diag
136133
});
137134
}
138135

@@ -146,19 +143,17 @@ where
146143
S: Into<MultiSpan>,
147144
F: FnOnce(&mut Diagnostic),
148145
{
149-
cx.struct_span_lint(lint, sp, |diag| {
150-
let mut diag = diag.build(msg);
151-
f(&mut diag);
152-
docs_link(&mut diag, lint);
153-
diag.emit();
146+
cx.struct_span_lint(lint, sp, msg, |diag| {
147+
f(diag);
148+
docs_link(diag, lint);
149+
diag
154150
});
155151
}
156152

157153
pub fn span_lint_hir(cx: &LateContext<'_>, lint: &'static Lint, hir_id: HirId, sp: Span, msg: &str) {
158-
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, |diag| {
159-
let mut diag = diag.build(msg);
160-
docs_link(&mut diag, lint);
161-
diag.emit();
154+
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg, |diag| {
155+
docs_link(diag, lint);
156+
diag
162157
});
163158
}
164159

@@ -170,11 +165,10 @@ pub fn span_lint_hir_and_then(
170165
msg: &str,
171166
f: impl FnOnce(&mut Diagnostic),
172167
) {
173-
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, |diag| {
174-
let mut diag = diag.build(msg);
175-
f(&mut diag);
176-
docs_link(&mut diag, lint);
177-
diag.emit();
168+
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg, |diag| {
169+
f(diag);
170+
docs_link(diag, lint);
171+
diag
178172
});
179173
}
180174

clippy_utils/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ pub fn is_self(slf: &Param<'_>) -> bool {
16101610

16111611
pub fn is_self_ty(slf: &hir::Ty<'_>) -> bool {
16121612
if let TyKind::Path(QPath::Resolved(None, path)) = slf.kind {
1613-
if let Res::SelfTy { .. } = path.res {
1613+
if let Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } = path.res {
16141614
return true;
16151615
}
16161616
}

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-2022-09-29"
2+
channel = "nightly-2022-10-06"
33
components = ["cargo", "llvm-tools-preview", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]

tests/ui-cargo/duplicate_mod/fail/src/main.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | / #[path = "b.rs"]
77
LL | | mod b2;
88
| |_______^ loaded again here
99
|
10-
= note: `-D clippy::duplicate-mod` implied by `-D warnings`
1110
= help: replace all but one `mod` item with `use` items
11+
= note: `-D clippy::duplicate-mod` implied by `-D warnings`
1212

1313
error: file is loaded as a module multiple times: `$DIR/c.rs`
1414
--> $DIR/main.rs:9:1

tests/ui-cargo/feature_name/fail/src/main.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: the "no-" prefix in the feature name "no-qaq" is negative
22
|
3-
= note: `-D clippy::negative-feature-names` implied by `-D warnings`
43
= help: consider renaming the feature to "qaq", but make sure the feature adds functionality
4+
= note: `-D clippy::negative-feature-names` implied by `-D warnings`
55

66
error: the "no_" prefix in the feature name "no_qaq" is negative
77
|
@@ -17,8 +17,8 @@ error: the "not_" prefix in the feature name "not_orz" is negative
1717

1818
error: the "-support" suffix in the feature name "qvq-support" is redundant
1919
|
20-
= note: `-D clippy::redundant-feature-names` implied by `-D warnings`
2120
= help: consider renaming the feature to "qvq"
21+
= note: `-D clippy::redundant-feature-names` implied by `-D warnings`
2222

2323
error: the "_support" suffix in the feature name "qvq_support" is redundant
2424
|

tests/ui-cargo/module_style/fail_mod/src/main.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error: `mod.rs` files are required, found `bad/inner.rs`
44
LL | pub mod stuff;
55
| ^
66
|
7-
= note: `-D clippy::self-named-module-files` implied by `-D warnings`
87
= help: move `bad/inner.rs` to `bad/inner/mod.rs`
8+
= note: `-D clippy::self-named-module-files` implied by `-D warnings`
99

1010
error: `mod.rs` files are required, found `bad/inner/stuff.rs`
1111
--> $DIR/bad/inner/stuff.rs:1:1

tests/ui-cargo/module_style/fail_mod_remap/src/main.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error: `mod.rs` files are required, found `bad.rs`
44
LL | pub mod inner;
55
| ^
66
|
7-
= note: `-D clippy::self-named-module-files` implied by `-D warnings`
87
= help: move `bad.rs` to `bad/mod.rs`
8+
= note: `-D clippy::self-named-module-files` implied by `-D warnings`
99

1010
error: aborting due to previous error
1111

tests/ui-cargo/module_style/fail_no_mod/src/main.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error: `mod.rs` files are not allowed, found `bad/mod.rs`
44
LL | pub struct Thing;
55
| ^
66
|
7-
= note: `-D clippy::mod-module-files` implied by `-D warnings`
87
= help: move `bad/mod.rs` to `bad.rs`
8+
= note: `-D clippy::mod-module-files` implied by `-D warnings`
99

1010
error: aborting due to previous error
1111

tests/ui-internal/check_clippy_version_attribute.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ LL | | report_in_external_macro: true
1010
LL | | }
1111
| |_^
1212
|
13+
= help: please use a valid semantic version, see `doc/adding_lints.md`
1314
note: the lint level is defined here
1415
--> $DIR/check_clippy_version_attribute.rs:1:9
1516
|
1617
LL | #![deny(clippy::internal)]
1718
| ^^^^^^^^^^^^^^^^
1819
= note: `#[deny(clippy::invalid_clippy_version_attribute)]` implied by `#[deny(clippy::internal)]`
19-
= help: please use a valid semantic version, see `doc/adding_lints.md`
2020
= note: this error originates in the macro `$crate::declare_tool_lint` which comes from the expansion of the macro `declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
2121

2222
error: this item has an invalid `clippy::version` attribute
@@ -46,8 +46,8 @@ LL | | report_in_external_macro: true
4646
LL | | }
4747
| |_^
4848
|
49-
= note: `#[deny(clippy::missing_clippy_version_attribute)]` implied by `#[deny(clippy::internal)]`
5049
= help: please use a `clippy::version` attribute, see `doc/adding_lints.md`
50+
= note: `#[deny(clippy::missing_clippy_version_attribute)]` implied by `#[deny(clippy::internal)]`
5151
= note: this error originates in the macro `$crate::declare_tool_lint` which comes from the expansion of the macro `declare_tool_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
5252

5353
error: this lint is missing the `clippy::version` attribute or version value

tests/ui-internal/if_chain_style.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ LL | | }
1010
LL | | }
1111
| |_____^
1212
|
13-
= note: `-D clippy::if-chain-style` implied by `-D warnings`
1413
help: this `let` statement can also be in the `if_chain!`
1514
--> $DIR/if_chain_style.rs:10:9
1615
|
1716
LL | let x = "";
1817
| ^^^^^^^^^^^
18+
= note: `-D clippy::if-chain-style` implied by `-D warnings`
1919

2020
error: `if a && b;` should be `if a; if b;`
2121
--> $DIR/if_chain_style.rs:19:12

tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error: `std::string::String` may not be held across an `await` point per `clippy
44
LL | let _x = String::from("hello");
55
| ^^
66
|
7-
= note: `-D clippy::await-holding-invalid-type` implied by `-D warnings`
87
= note: strings are bad
8+
= note: `-D clippy::await-holding-invalid-type` implied by `-D warnings`
99

1010
error: `std::net::Ipv4Addr` may not be held across an `await` point per `clippy.toml`
1111
--> $DIR/await_holding_invalid_type.rs:10:9

tests/ui-toml/conf_deprecated_key/conf_deprecated_key.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ error: the function has a cognitive complexity of (3/2)
88
LL | fn cognitive_complexity() {
99
| ^^^^^^^^^^^^^^^^^^^^
1010
|
11-
= note: `-D clippy::cognitive-complexity` implied by `-D warnings`
1211
= help: you could split it up into multiple smaller functions
12+
= note: `-D clippy::cognitive-complexity` implied by `-D warnings`
1313

1414
error: aborting due to previous error; 2 warnings emitted
1515

tests/ui-toml/expect_used/expect_used.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error: used `expect()` on `an Option` value
44
LL | let _ = opt.expect("");
55
| ^^^^^^^^^^^^^^
66
|
7-
= note: `-D clippy::expect-used` implied by `-D warnings`
87
= help: if this value is `None`, it will panic
8+
= note: `-D clippy::expect-used` implied by `-D warnings`
99

1010
error: used `expect()` on `a Result` value
1111
--> $DIR/expect_used.rs:11:13

tests/ui-toml/fn_params_excessive_bools/test.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error: more than 1 bools in function parameters
44
LL | fn g(_: bool, _: bool) {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: `-D clippy::fn-params-excessive-bools` implied by `-D warnings`
87
= help: consider refactoring bools into two-variant enums
8+
= note: `-D clippy::fn-params-excessive-bools` implied by `-D warnings`
99

1010
error: aborting due to previous error
1111

tests/ui-toml/large_include_file/large_include_file.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error: attempted to include a large file
44
LL | const TOO_BIG_INCLUDE_BYTES: &[u8; 654] = include_bytes!("too_big.txt");
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: `-D clippy::large-include-file` implied by `-D warnings`
87
= note: the configuration allows a maximum size of 600 bytes
8+
= note: `-D clippy::large-include-file` implied by `-D warnings`
99
= note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
1010

1111
error: attempted to include a large file

tests/ui-toml/strict_non_send_fields_in_send_ty/test.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ error: some fields in `NoGeneric` are not safe to be sent to another thread
44
LL | unsafe impl Send for NoGeneric {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: `-D clippy::non-send-fields-in-send-ty` implied by `-D warnings`
87
note: it is not safe to send field `rc_is_not_send` to another thread
98
--> $DIR/test.rs:8:5
109
|
1110
LL | rc_is_not_send: Rc<String>,
1211
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
1312
= help: use a thread-safe type that implements `Send`
13+
= note: `-D clippy::non-send-fields-in-send-ty` implied by `-D warnings`
1414

1515
error: some fields in `MultiField<T>` are not safe to be sent to another thread
1616
--> $DIR/test.rs:19:1

tests/ui-toml/struct_excessive_bools/test.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ LL | | a: bool,
66
LL | | }
77
| |_^
88
|
9-
= note: `-D clippy::struct-excessive-bools` implied by `-D warnings`
109
= help: consider using a state machine or refactoring bools into two-variant enums
10+
= note: `-D clippy::struct-excessive-bools` implied by `-D warnings`
1111

1212
error: aborting due to previous error
1313

tests/ui-toml/unwrap_used/unwrap_used.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ error: used `unwrap()` on `an Option` value
1616
LL | let _ = boxed_slice.get(1).unwrap();
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1818
|
19-
= note: `-D clippy::unwrap-used` implied by `-D warnings`
2019
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
20+
= note: `-D clippy::unwrap-used` implied by `-D warnings`
2121

2222
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
2323
--> $DIR/unwrap_used.rs:36:17

tests/ui/absurd-extreme-comparisons.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error: this comparison involving the minimum or maximum element for this type co
44
LL | u <= 0;
55
| ^^^^^^
66
|
7-
= note: `-D clippy::absurd-extreme-comparisons` implied by `-D warnings`
87
= help: because `0` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `u == 0` instead
8+
= note: `-D clippy::absurd-extreme-comparisons` implied by `-D warnings`
99

1010
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
1111
--> $DIR/absurd-extreme-comparisons.rs:15:5

tests/ui/allow_attributes_without_reason.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ error: `allow` attribute without specifying a reason
44
LL | #[allow(dead_code)]
55
| ^^^^^^^^^^^^^^^^^^^
66
|
7+
= help: try adding a reason at the end with `, reason = ".."`
78
note: the lint level is defined here
89
--> $DIR/allow_attributes_without_reason.rs:2:9
910
|
1011
LL | #![deny(clippy::allow_attributes_without_reason)]
1112
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12-
= help: try adding a reason at the end with `, reason = ".."`
1313

1414
error: `allow` attribute without specifying a reason
1515
--> $DIR/allow_attributes_without_reason.rs:6:1

tests/ui/approx_const.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error: approximate value of `f{32, 64}::consts::E` found
44
LL | let my_e = 2.7182;
55
| ^^^^^^
66
|
7-
= note: `-D clippy::approx-constant` implied by `-D warnings`
87
= help: consider using the constant directly
8+
= note: `-D clippy::approx-constant` implied by `-D warnings`
99

1010
error: approximate value of `f{32, 64}::consts::E` found
1111
--> $DIR/approx_const.rs:5:20

0 commit comments

Comments
 (0)