mirror of
https://github.com/astral-sh/ruff
synced 2026-01-09 15:44:22 -05:00
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:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user