DiagnosticId::RangeFormatNotebook -> InvalidCliOption

This commit is contained in:
Brent Westbrook 2025-09-26 17:18:39 -04:00
parent c1a3b44a05
commit 73eb86d0f5
2 changed files with 6 additions and 6 deletions

View file

@ -924,7 +924,7 @@ impl From<&FormatCommandError> for Diagnostic {
} }
}, },
FormatCommandError::RangeFormatNotebook(_) => Diagnostic::new( FormatCommandError::RangeFormatNotebook(_) => Diagnostic::new(
DiagnosticId::RangeFormatNotebook, DiagnosticId::InvalidCliOption,
Severity::Error, Severity::Error,
"Range formatting isn't supported for notebooks.", "Range formatting isn't supported for notebooks.",
), ),
@ -1314,7 +1314,7 @@ mod tests {
io: Cannot write to file io: Cannot write to file
--> test.py:1:1 --> test.py:1:1
range-format-notebook: Range formatting isn't supported for notebooks. invalid-cli-option: Range formatting isn't supported for notebooks.
--> test.py:1:1 --> test.py:1:1
panic: Panicked at <location> when checking `test.py`: `Test panic for FormatCommandError` panic: Panicked at <location> when checking `test.py`: `Test panic for FormatCommandError`

View file

@ -445,7 +445,7 @@ impl Diagnostic {
| DiagnosticId::UselessOverridesSection | DiagnosticId::UselessOverridesSection
| DiagnosticId::DeprecatedSetting | DiagnosticId::DeprecatedSetting
| DiagnosticId::Unformatted | DiagnosticId::Unformatted
| DiagnosticId::RangeFormatNotebook | DiagnosticId::InvalidCliOption
| DiagnosticId::FormatError => None, | DiagnosticId::FormatError => None,
DiagnosticId::Lint(lint_name) => { DiagnosticId::Lint(lint_name) => {
Some(format!("{}/rules/{lint_name}", env!("CARGO_PKG_HOMEPAGE"))) Some(format!("{}/rules/{lint_name}", env!("CARGO_PKG_HOMEPAGE")))
@ -1036,8 +1036,8 @@ pub enum DiagnosticId {
/// The code needs to be formatted. /// The code needs to be formatted.
Unformatted, Unformatted,
/// Range formatting isn't supported for notebooks. /// Use of an invalid command-line option.
RangeFormatNotebook, InvalidCliOption,
/// Something went wrong while formatting. /// Something went wrong while formatting.
/// ///
@ -1083,7 +1083,7 @@ impl DiagnosticId {
DiagnosticId::UselessOverridesSection => "useless-overrides-section", DiagnosticId::UselessOverridesSection => "useless-overrides-section",
DiagnosticId::DeprecatedSetting => "deprecated-setting", DiagnosticId::DeprecatedSetting => "deprecated-setting",
DiagnosticId::Unformatted => "unformatted", DiagnosticId::Unformatted => "unformatted",
DiagnosticId::RangeFormatNotebook => "range-format-notebook", DiagnosticId::InvalidCliOption => "invalid-cli-option",
DiagnosticId::FormatError => "format-error", DiagnosticId::FormatError => "format-error",
} }
} }