Also check code generated by macros

This commit is contained in:
Guillaume Gomez 2023-12-16 18:15:32 +01:00
parent 91fd01c31c
commit 6b444f3092
3 changed files with 104 additions and 110 deletions

View file

@ -1,6 +1,7 @@
//@no-rustfix
#![warn(clippy::unconditional_recursion)]
#![allow(clippy::partialeq_ne_impl)]
enum Foo {
A,
@ -123,6 +124,40 @@ impl PartialEq for S3 {
}
}
// There should be no warning here!
#[derive(PartialEq)]
enum E {
A,
B,
}
#[derive(PartialEq)]
struct Bar<T: PartialEq>(T);
struct S4;
impl PartialEq for S4 {
fn eq(&self, other: &Self) -> bool {
// No warning here.
Bar(self) == Bar(other)
}
}
macro_rules! impl_partial_eq {
($ty:ident) => {
impl PartialEq for $ty {
fn eq(&self, other: &Self) -> bool {
self == other
}
}
};
}
struct S5;
impl_partial_eq!(S5);
//~^ ERROR: function cannot return without recursing
fn main() {
// test code goes here
}