// run-rustfix

#![feature(const_if_match)]
#![feature(const_loop)]
#![feature(const_result)]
#![warn(clippy::redundant_pattern_matching)]
#![allow(unused)]

// Test that results are linted with the feature enabled.

const fn issue_5697() {
    if Ok::<i32, i32>(42).is_ok() {}

    if Err::<i32, i32>(42).is_err() {}

    while Ok::<i32, i32>(10).is_ok() {}

    while Ok::<i32, i32>(10).is_err() {}

    Ok::<i32, i32>(42).is_ok();

    Err::<i32, i32>(42).is_err();

    // These should not be linted until `const_option` is implemented.
    // See https://github.com/rust-lang/rust/issues/67441

    if let Some(_) = Some(42) {}

    if let None = None::<()> {}

    while let Some(_) = Some(42) {}

    while let None = None::<()> {}

    match Some(42) {
        Some(_) => true,
        None => false,
    };

    match None::<()> {
        Some(_) => false,
        None => true,
    };
}

fn main() {}