mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
Refactor Options
representation (#7591)
This commit is contained in:
parent
f137819536
commit
2ecf59726f
7 changed files with 343 additions and 177 deletions
|
@ -7,6 +7,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
|
|||
use serde::{Deserialize, Serialize};
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use crate::options_base::{OptionsMetadata, Visit};
|
||||
use ruff_linter::line_width::{LineLength, TabSize};
|
||||
use ruff_linter::rules::flake8_pytest_style::settings::SettingsError;
|
||||
use ruff_linter::rules::flake8_pytest_style::types;
|
||||
|
@ -2399,10 +2400,6 @@ pub enum FormatOrOutputFormat {
|
|||
}
|
||||
|
||||
impl FormatOrOutputFormat {
|
||||
pub const fn metadata() -> crate::options_base::OptionGroup {
|
||||
FormatOptions::metadata()
|
||||
}
|
||||
|
||||
pub const fn as_output_format(&self) -> Option<SerializationFormat> {
|
||||
match self {
|
||||
FormatOrOutputFormat::Format(_) => None,
|
||||
|
@ -2411,6 +2408,12 @@ impl FormatOrOutputFormat {
|
|||
}
|
||||
}
|
||||
|
||||
impl OptionsMetadata for FormatOrOutputFormat {
|
||||
fn record(visit: &mut dyn Visit) {
|
||||
FormatOptions::record(visit);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions,
|
||||
)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue