1
Fork 0

Let lint_forgetting_references give the suggestion if possible

This commit is contained in:
surechen 2024-05-25 11:44:14 +08:00
parent d7f0d1f564
commit ac736d6d88
10 changed files with 383 additions and 45 deletions

View file

@ -657,10 +657,14 @@ pub struct ForLoopsOverFalliblesSuggestion<'a> {
}
#[derive(Subdiagnostic)]
pub enum IgnoreDropSuggestion {
#[note(lint_note)]
pub enum UseLetUnderscoreIgnoreSuggestion {
#[note(lint_use_let_underscore_ignore_suggestion)]
Note,
#[multipart_suggestion(lint_suggestion, style = "verbose", applicability = "maybe-incorrect")]
#[multipart_suggestion(
lint_use_let_underscore_ignore_suggestion,
style = "verbose",
applicability = "maybe-incorrect"
)]
Suggestion {
#[suggestion_part(code = "let _ = ")]
start_span: Span,
@ -677,7 +681,7 @@ pub struct DropRefDiag<'a> {
#[label]
pub label: Span,
#[subdiagnostic]
pub sugg: IgnoreDropSuggestion,
pub sugg: UseLetUnderscoreIgnoreSuggestion,
}
#[derive(LintDiagnostic)]
@ -705,11 +709,12 @@ pub enum DropCopySuggestion {
#[derive(LintDiagnostic)]
#[diag(lint_forgetting_references)]
#[note]
pub struct ForgetRefDiag<'a> {
pub arg_ty: Ty<'a>,
#[label]
pub label: Span,
#[subdiagnostic]
pub sugg: UseLetUnderscoreIgnoreSuggestion,
}
#[derive(LintDiagnostic)]
@ -719,7 +724,7 @@ pub struct ForgetCopyDiag<'a> {
#[label]
pub label: Span,
#[subdiagnostic]
pub sugg: IgnoreDropSuggestion,
pub sugg: UseLetUnderscoreIgnoreSuggestion,
}
#[derive(LintDiagnostic)]