Repository: astral-sh/ruff
File: crates/ty_python_semantic/src/types/diagnostic.rs (Rust)

Code before:
    /// ## What it does
    /// Checks for expressions that are used as [type expressions]
    /// but cannot validly be interpreted as such.
    ///
    /// ## Why is this bad?
    /// Such expressions cannot be understood by ty.
    /// In some cases, they might raise errors at runtime.
    ///
    /// ## Examples
    /// ```python
    /// from typing import Annotated
    ///
    /// a: type[1]  # `1` is not a type
    /// b: Annotated[int]  # `Annotated` expects at least two arguments
    /// ```
    /// [type expressions]: https://typing.python.org/en/latest/spec/annotations.html#type-and-annotation-expressions
    pub(crate) static INVALID_TYPE_FORM = {
        summary: "detects invalid type forms",
        status: LintStatus::stable("0.0.1-alpha.1"),
        default_level: Level::Error,
    }
}

declare_lint! {
    /// ## What it does
    /// Checks for called match patterns where the called object is not a type.
    ///
    /// ## Why is this bad?
    /// Such called patterns are invalid and lead to runtime errors.
    ///
    /// ## Examples
    /// ```python
    /// def _(foo):
    ///     bar = "bar"
    ///     match foo:
    ///         case bar():    # called match pattern must be a type
    ///             ...
    /// ```
    pub(crate) static CALLED_MATCH_PATTERN_MUST_BE_A_TYPE = {
        summary: "detect invalid called match patterns",
        status: LintStatus::stable("0.0.16"),
        default_level: Level::Error,
    }
}

declare_lint! {
    /// ## What it does
    /// Checks for type guard functions without
    /// a first non-self-like non-keyword-only non-variadic parameter.
    ///
    /// ## Why is this bad?

Review comment (suggestion):
> Checks for called match patterns

Is the terminology "called match patterns" standard? I think we call them "class patterns" elsewhere, and I guess that's also the terminology used in the Python documentation?

If so, can we please update the terminology throughout this changeset.

> where the called object is not a type

Similar here. I don't think anything is being called.

Code after:
}

declare_lint! {
    /// ## What it does
    /// Checks for expressions that are used as [type expressions]
    /// but cannot validly be interpreted as such.
    ///
    /// ## Why is this bad?
    /// Such expressions cannot be understood by ty.
    /// In some cases, they might raise errors at runtime.
    ///
    /// ## Examples
    /// ```python
    /// from typing import Annotated
    ///
    /// a: type[1]  # `1` is not a type
    /// b: Annotated[int]  # `Annotated` expects at least two arguments
    /// ```
    /// [type expressions]: https://typing.python.org/en/latest/spec/annotations.html#type-and-annotation-expressions
    pub(crate) static INVALID_TYPE_FORM = {
        summary: "detects invalid type forms",
        status: LintStatus::stable("0.0.1-alpha.1"),
        default_level: Level::Error,
    }
}

declare_lint! {
    /// ## What it does
    /// Checks for invalid match patterns.
    ///
    /// ## Why is this bad?
    /// Matching on invalid patterns will lead to a runtime error.
    ///
    /// ## Examples
    /// ```python
    /// NotAClass = 42
    ///
    /// match x:
    ///     case NotAClass():    # TypeError at runtime: must be a class
    ///         ...
    /// ```
    pub(crate) static INVALID_MATCH_PATTERN = {
        summary: "detect invalid match patterns",
        status: LintStatus::stable("0.0.18"),
        default_level: Level::Error,
    }
}

declare_lint! {
    /// ## What it does
    /// Checks for type guard functions without