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

0 commit comments

Comments
 (0)