blob: 32d81688e7d3a9dc203e787097b11d33382c45dd [file]
#![warn(clippy::equatable_if_let)]
#![allow(clippy::eq_op)]
#![feature(const_trait_impl, const_cmp)]
fn issue15376() {
enum ConstEq {
A,
B,
}
const impl PartialEq for ConstEq {
fn eq(&self, _other: &Self) -> bool {
true
}
}
const C: ConstEq = ConstEq::A;
// `impl PartialEq` is const... but we still suggest `matches!` for now
// TODO: detect this and suggest `=`
const _: u32 = if matches!(C, ConstEq::A) { 0 } else { 1 };
//~^ ERROR: this pattern matching can be expressed using `matches!`
const _: u32 = if matches!(Some(C), Some(ConstEq::A)) { 0 } else { 1 };
//~^ ERROR: this pattern matching can be expressed using `matches!`
}