2023-07-04 13:36:56 -05:00
|
|
|
#![allow(unused)]
|
|
|
|
#![warn(clippy::error_impl_error)]
|
|
|
|
#![no_main]
|
|
|
|
|
2023-07-06 21:58:11 -05:00
|
|
|
pub mod a {
|
2023-07-04 13:36:56 -05:00
|
|
|
#[derive(Debug)]
|
2023-07-06 21:58:11 -05:00
|
|
|
pub struct Error;
|
2023-07-28 14:35:48 -05:00
|
|
|
//~^ ERROR: exported type named `Error` that implements `Error`
|
2023-07-04 13:36:56 -05:00
|
|
|
|
|
|
|
impl std::fmt::Display for Error {
|
|
|
|
fn fmt(&self, _: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::error::Error for Error {}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod b {
|
|
|
|
#[derive(Debug)]
|
2023-07-18 10:25:58 -05:00
|
|
|
pub(super) enum Error {}
|
2023-07-28 14:35:48 -05:00
|
|
|
//~^ ERROR: exported type named `Error` that implements `Error`
|
2023-07-04 13:36:56 -05:00
|
|
|
|
|
|
|
impl std::fmt::Display for Error {
|
|
|
|
fn fmt(&self, _: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::error::Error for Error {}
|
|
|
|
}
|
|
|
|
|
2023-07-06 21:58:11 -05:00
|
|
|
pub mod c {
|
|
|
|
pub union Error {
|
2023-07-28 14:35:48 -05:00
|
|
|
//~^ ERROR: exported type named `Error` that implements `Error`
|
2023-07-04 13:36:56 -05:00
|
|
|
a: u32,
|
|
|
|
b: u32,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::fmt::Debug for Error {
|
|
|
|
fn fmt(&self, _: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::fmt::Display for Error {
|
|
|
|
fn fmt(&self, _: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::error::Error for Error {}
|
|
|
|
}
|
|
|
|
|
2023-07-06 21:58:11 -05:00
|
|
|
pub mod d {
|
|
|
|
pub type Error = std::fmt::Error;
|
2023-07-28 14:35:48 -05:00
|
|
|
//~^ ERROR: exported type alias named `Error` that implements `Error`
|
2023-07-04 13:36:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod e {
|
|
|
|
#[derive(Debug)]
|
2023-07-18 10:25:58 -05:00
|
|
|
pub(super) struct MyError;
|
2023-07-04 13:36:56 -05:00
|
|
|
|
|
|
|
impl std::fmt::Display for MyError {
|
|
|
|
fn fmt(&self, _: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::error::Error for MyError {}
|
|
|
|
}
|
|
|
|
|
2023-07-18 10:25:58 -05:00
|
|
|
pub mod f {
|
|
|
|
pub type MyError = std::fmt::Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do not lint module-private types
|
|
|
|
|
|
|
|
mod g {
|
|
|
|
#[derive(Debug)]
|
|
|
|
enum Error {}
|
|
|
|
|
|
|
|
impl std::fmt::Display for Error {
|
|
|
|
fn fmt(&self, _: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::error::Error for Error {}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod h {
|
|
|
|
type Error = std::fmt::Error;
|
2023-07-04 13:36:56 -05:00
|
|
|
}
|