Make dependency get-size2 truly optional in ruff_python_ast (#19052)

Gates all uses of `get-size2` behind the feature `get-size` in the crate
`ruff_python_ast`. Also requires that `ruff_text_size` is pulled in with
the feature `get-size` enabled if we enable the same-named feature for
`ruff_python_ast`.
This commit is contained in:
Dylan 2025-06-30 21:50:59 -05:00 committed by GitHub
parent 28ab61d885
commit 4bc170a5c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View file

@ -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

View file

@ -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 {

View file

@ -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