mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:21 +00:00
Remove functor from autofix title (#4245)
This commit is contained in:
parent
8969ad5879
commit
a2b8487ae3
61 changed files with 234 additions and 305 deletions
|
@ -30,10 +30,13 @@ pub trait Violation: Debug + PartialEq + Eq {
|
|||
None
|
||||
}
|
||||
|
||||
/// If autofix is (potentially) available for this violation returns another
|
||||
/// function that in turn can be used to obtain a string describing the
|
||||
/// autofix.
|
||||
fn autofix_title_formatter(&self) -> Option<fn(&Self) -> String> {
|
||||
// TODO micha: Move `autofix_title` to `Fix`, add new `advice` method that is shown as an advice.
|
||||
// Change the `Diagnostic` renderer to show the advice, and render the fix message after the `Suggested fix: <here>`
|
||||
|
||||
/// Returns the title for the autofix. The message is also shown as an advice as part of the diagnostics.
|
||||
///
|
||||
/// Required for rules that have autofixes.
|
||||
fn autofix_title(&self) -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
|
@ -72,8 +75,8 @@ impl<VA: AlwaysAutofixableViolation> Violation for VA {
|
|||
<Self as AlwaysAutofixableViolation>::explanation()
|
||||
}
|
||||
|
||||
fn autofix_title_formatter(&self) -> Option<fn(&Self) -> String> {
|
||||
Some(Self::autofix_title)
|
||||
fn autofix_title(&self) -> Option<String> {
|
||||
Some(<Self as AlwaysAutofixableViolation>::autofix_title(self))
|
||||
}
|
||||
|
||||
fn message_formats() -> &'static [&'static str] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue