Skip to content

Commit

Permalink
Explicitly add schemars to ruff_python_ast Cargo.toml (#12275)
Browse files Browse the repository at this point in the history
Co-authored-by: Micha Reiser <micha@reiser.io>
  • Loading branch information
GaetanLepage and MichaReiser authored Jul 11, 2024
1 parent bbb9fe1 commit d0298dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions crates/ruff_linter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ruff_cache = { workspace = true }
ruff_diagnostics = { workspace = true, features = ["serde"] }
ruff_notebook = { workspace = true }
ruff_macros = { workspace = true }
ruff_python_ast = { workspace = true, features = ["serde"] }
ruff_python_ast = { workspace = true, features = ["serde", "cache"] }
ruff_python_codegen = { workspace = true }
ruff_python_index = { workspace = true }
ruff_python_literal = { workspace = true }
Expand Down Expand Up @@ -79,7 +79,7 @@ colored = { workspace = true, features = ["no-color"] }

[features]
default = []
schemars = ["dep:schemars"]
schemars = ["dep:schemars", "ruff_python_ast/schemars"]
# Enables rules for internal integration tests
test-rules = []

Expand Down
4 changes: 3 additions & 1 deletion crates/ruff_python_ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ serde = { workspace = true, optional = true }
compact_str = { workspace = true }

[features]
serde = ["dep:serde", "ruff_text_size/serde", "dep:ruff_cache", "compact_str/serde", "dep:ruff_macros", "dep:schemars"]
schemars = ["dep:schemars"]
cache = ["dep:ruff_cache", "dep:ruff_macros"]
serde = ["dep:serde", "ruff_text_size/serde", "dep:ruff_cache", "compact_str/serde"]

[lints]
workspace = true
Expand Down
8 changes: 3 additions & 5 deletions crates/ruff_python_ast/src/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ use std::ops::Deref;
use crate::{nodes, Expr};

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[cfg_attr(
feature = "serde",
derive(serde::Serialize, serde::Deserialize, ruff_macros::CacheKey)
)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "cache", derive(ruff_macros::CacheKey))]
pub struct Name(compact_str::CompactString);

impl Name {
Expand Down Expand Up @@ -179,7 +177,7 @@ impl PartialEq<Name> for &String {
}
}

#[cfg(feature = "serde")]
#[cfg(feature = "schemars")]
impl schemars::JsonSchema for Name {
fn is_referenceable() -> bool {
String::is_referenceable()
Expand Down

0 comments on commit d0298dc

Please sign in to comment.