1
Fork 0

Detect empty leading where-clauses on type aliases

This commit is contained in:
León Orell Valerian Liehr 2024-02-20 04:41:01 +01:00
parent 2b8060578a
commit cce81289e6
No known key found for this signature in database
GPG key ID: D17A07215F68E713
11 changed files with 178 additions and 68 deletions

View file

@ -428,15 +428,22 @@ pub(super) fn builtin(sess: &Session, diagnostic: BuiltinLintDiagnostics, diag:
diag.note("see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration");
}
}
BuiltinLintDiagnostics::DeprecatedWhereclauseLocation(new_span, suggestion) => {
diag.multipart_suggestion(
"move it to the end of the type declaration",
vec![(diag.span.primary_span().unwrap(), "".to_string()), (new_span, suggestion)],
Applicability::MachineApplicable,
);
diag.note(
"see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information",
);
BuiltinLintDiagnostics::DeprecatedWhereclauseLocation(sugg) => {
let left_sp = diag.span.primary_span().unwrap();
match sugg {
Some((right_sp, sugg)) => diag.multipart_suggestion(
"move it to the end of the type declaration",
vec![(left_sp, String::new()), (right_sp, sugg)],
Applicability::MachineApplicable,
),
None => diag.span_suggestion(
left_sp,
"remove this `where`",
"",
Applicability::MachineApplicable,
),
};
diag.note("see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information");
}
BuiltinLintDiagnostics::SingleUseLifetime {
param_span,