diff --git a/crates/ruff_python_ast/Cargo.toml b/crates/ruff_python_ast/Cargo.toml index 1b049102f6..5a50f4ee74 100644 --- a/crates/ruff_python_ast/Cargo.toml +++ b/crates/ruff_python_ast/Cargo.toml @@ -41,7 +41,10 @@ serde = [ "dep:ruff_cache", "compact_str/serde", ] -get-size = ["dep:get-size2"] +get-size = [ + "dep:get-size2", + "ruff_text_size/get-size" +] [lints] workspace = true diff --git a/crates/ruff_python_ast/src/node_index.rs b/crates/ruff_python_ast/src/node_index.rs index bf53ac386c..094a5460d7 100644 --- a/crates/ruff_python_ast/src/node_index.rs +++ b/crates/ruff_python_ast/src/node_index.rs @@ -19,7 +19,8 @@ where /// /// This type is interiorly mutable to allow assigning node indices /// on-demand after parsing. -#[derive(Default, get_size2::GetSize)] +#[derive(Default)] +#[cfg_attr(feature = "get-size", derive(get_size2::GetSize))] pub struct AtomicNodeIndex(AtomicU32); impl AtomicNodeIndex { diff --git a/crates/ruff_python_ast/src/nodes.rs b/crates/ruff_python_ast/src/nodes.rs index a3ad37faed..fc9c3f8851 100644 --- a/crates/ruff_python_ast/src/nodes.rs +++ b/crates/ruff_python_ast/src/nodes.rs @@ -875,6 +875,7 @@ bitflags! { } } +#[cfg(feature = "get-size")] impl get_size2::GetSize for InterpolatedStringFlagsInner {} /// Flags that can be queried to obtain information @@ -1462,6 +1463,7 @@ bitflags! { } } +#[cfg(feature = "get-size")] impl get_size2::GetSize for StringLiteralFlagsInner {} /// Flags that can be queried to obtain information @@ -1880,6 +1882,7 @@ bitflags! { } } +#[cfg(feature = "get-size")] impl get_size2::GetSize for BytesLiteralFlagsInner {} /// Flags that can be queried to obtain information