//! 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()
}

/// Returns `true` if the
/// [`fluent_layout_split_first_call`](https://github.com/astral-sh/ruff/pull/21369) preview
/// style is enabled.
pub(crate) const fn is_fluent_layout_split_first_call_enabled(context: &PyFormatContext) -> bool {
    context.is_preview()
}

/// Returns `true` if the
/// [trailing pragma width handling in comments](https://github.com/astral-sh/ruff/pull/24071)
/// is enabled.
/// When enabled, comments like `# text # noqa: F401` only reserve width for
/// the non-pragma prefix (`# text`), not the trailing pragma.
/// Make sure to stabilize the corresponding linter preview behavior when stabilizing this preview style.
pub(crate) const fn is_trailing_pragma_in_comment_width_enabled(context: &PyFormatContext) -> bool {
    context.is_preview()
}
