mirror of https://github.com/astral-sh/ruff
refactor: Make flake8_tidy_imports::Settings derive Default
This commit is contained in:
parent
2fce580693
commit
005f5d7911
|
|
@ -7,17 +7,8 @@ pub mod options;
|
||||||
pub mod banned_api;
|
pub mod banned_api;
|
||||||
pub mod relative_imports;
|
pub mod relative_imports;
|
||||||
|
|
||||||
#[derive(Debug, Hash)]
|
#[derive(Debug, Hash, Default)]
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
pub ban_relative_imports: Strictness,
|
pub ban_relative_imports: Strictness,
|
||||||
pub banned_api: HashableHashMap<String, ApiBan>,
|
pub banned_api: HashableHashMap<String, ApiBan>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Settings {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
ban_relative_imports: Strictness::Parents,
|
|
||||||
banned_api: HashableHashMap::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,11 @@ use crate::define_violation;
|
||||||
use crate::registry::Diagnostic;
|
use crate::registry::Diagnostic;
|
||||||
use crate::violation::Violation;
|
use crate::violation::Violation;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash, JsonSchema)]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash, JsonSchema, Default)]
|
||||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||||
pub enum Strictness {
|
pub enum Strictness {
|
||||||
/// Ban imports that extend into the parent module or beyond.
|
/// Ban imports that extend into the parent module or beyond.
|
||||||
|
#[default]
|
||||||
Parents,
|
Parents,
|
||||||
/// Ban all relative imports.
|
/// Ban all relative imports.
|
||||||
All,
|
All,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue