Add lint against Iterator::map receiving a callable that returns ()

This commit is contained in:
Obei Sideg 2023-02-16 22:04:59 +03:00
parent 8b1dbf728a
commit a914f37409
6 changed files with 134 additions and 1 deletions

View file

@ -748,6 +748,22 @@ impl AddToDiagnostic for HiddenUnicodeCodepointsDiagSub {
}
}
// map_unit_fn.rs
#[derive(LintDiagnostic)]
#[diag(lint_map_unit_fn)]
#[note]
pub struct MappingToUnit {
#[label(lint_function_label)]
pub function_label: Span,
#[label(lint_argument_label)]
pub argument_label: Span,
#[label(lint_map_label)]
pub map_label: Span,
#[suggestion(style = "verbose", code = "{replace}", applicability = "maybe-incorrect")]
pub suggestion: Span,
pub replace: String,
}
// internal.rs
#[derive(LintDiagnostic)]
#[diag(lint_default_hash_types)]