mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-17 22:08:28 +00:00

## Summary This PR stabilizies the fix for https://github.com/astral-sh/ruff/issues/14001 We try to only make breaking formatting changes once a year. However, the plan was to release this fix as part of Ruff 0.9 but I somehow missed it when promoting all other formatter changes. I think it's worth making an exception here considering that this is a bug fix, it improves readability, and it should be rare (very few files in a single project). Our version policy explicitly allows breaking formatter changes in any minor release and the idea of only making breaking formatter changes once a year is mainly to avoid multiple releases throughout the year that introduce large formatter changes Closes https://github.com/astral-sh/ruff/issues/14001 ## Test Plan Updated snapshot
15 lines
808 B
Rust
15 lines
808 B
Rust
//! Helpers to test if a specific preview style is enabled or not.
|
|
//!
|
|
//! The motivation for these functions isn't to avoid code duplication but to ease promoting preview styles
|
|
//! to stable. The challenge with directly using [`is_preview`](PyFormatContext::is_preview) is that it is unclear
|
|
//! for which specific feature this preview check is for. Having named functions simplifies the promotion:
|
|
//! Simply delete the function and let Rust tell you which checks you have to remove.
|
|
|
|
use crate::PyFormatContext;
|
|
|
|
/// Returns `true` if the [`hug_parens_with_braces_and_square_brackets`](https://github.com/astral-sh/ruff/issues/8279) preview style is enabled.
|
|
pub(crate) const fn is_hug_parens_with_braces_and_square_brackets_enabled(
|
|
context: &PyFormatContext,
|
|
) -> bool {
|
|
context.is_preview()
|
|
}
|