You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: unrecognized_platform.rs
    path of file: ./repos/ruff/crates/ruff_linter/src/rules/flake8_pyi/rules
    
    the code of the file until where you have to start completion: use ruff_python_ast::{self as ast, CmpOp, Expr};

use ruff_diagnostics::{Diagnostic, Violation};
use ruff_macros::{derive_message_formats, violation};
use ruff_text_size::Ranged;

use crate::checkers::ast::Checker;
use crate::registry::Rule;

/// ## What it does
/// Check for unrecognized `sys.platform` checks. Platform checks should be
/// simple string comparisons.
///
/// **Note**: this rule is only enabled in `.pyi` stub files.
///
/// ## Why is this bad?
/// Some `sys.platform` checks are too complex for type checkers to
/// understand, and thus result in false positives. `sys.platform` checks
/// should be simple string comparisons, like `sys.platform == "linux"`.
///
/// ## Example
/// ```python
/// if sys.platform.startswith("linux"):
///     # Linux specific definitions
///     ...
/// else:
///     # Posix specific definitions
///     ...
/// ```
///
/// Instead, use a simple string comparison, such as `==` or `!=`:
/// ```python
/// if sys.platform == "linux":
///     # Linux specific definitions
///     ...
/// else:
///     # Posix specific definitions
///     ...
/// ```
///
/// ## References
/// - [PEP 484](https://peps.python.org/pep-0484/#version-and-platform-checking)
#[violation]
pub struct UnrecognizedPlatformCheck;

impl Violation for Unrecogni
    
pub(crate) fn unrecognized_platform(checker: &mut Checker, test: &Expr) {
    let Expr::Compare(ast::ExprCompare {
        left,
        ops,
        comparators,
        ..
    }) = test
    else {
        return;
    };

    let ([op], [right]) = (&**ops, &**comparators) else {
        return;
    };

    if !checker
        .semantic()
        .resolve_qualified_name(left)
        .is_some_and(|qualified_name| matches!(qualified_name.segments(), ["sys", "platform"]))
    {
        return;
    }

    // "in" might also make sense but we don't currently have one.
    if !matches!(op, CmpOp::Eq | CmpOp::NotEq) {
        if checker.enabled(Rule::UnrecognizedPlatformCheck) {
            checker
                .diagnostics
                .push(Diagnostic::new(UnrecognizedPlatformCheck, test.range()));
        }
        return;
    }

    if let Expr::StringLiteral(ast::ExprStringLiteral { value, .. }) = right {
        // Other values are possible but we don't need them right now.
        // This protects against typos.
        if checker.enabled(Rule::UnrecognizedPlatformName) {
            if !matches!(value.to_str(), "linux" | "win32" | "cygwin" | "darwin") {
                checker.diagnostics.push(Diagnostic::new(
                    UnrecognizedPlatformName {
                        platform: value.to_string(),
                    },
                    right.range(),
                ));
            }
        }
    } else {
        if checker.enabled(Rule::UnrecognizedPlatformCheck) {
            checker
                .diagnostics
                .push(Diagnostic::new(UnrecognizedPlatformCheck, test.range()));
        }
    }
}