#![warn(clippy::result_unit_err)] pub fn returns_unit_error() -> Result { Err(()) } fn private_unit_errors() -> Result { Err(()) } pub trait HasUnitError { fn get_that_error(&self) -> Result; fn get_this_one_too(&self) -> Result { Err(()) } } impl HasUnitError for () { fn get_that_error(&self) -> Result { Ok(true) } } trait PrivateUnitError { fn no_problem(&self) -> Result; } pub struct UnitErrorHolder; impl UnitErrorHolder { pub fn unit_error(&self) -> Result { Ok(0) } } // https://github.com/rust-lang/rust-clippy/issues/6546 pub mod issue_6546 { type ResInv = Result; pub fn should_lint() -> ResInv<(), usize> { Ok(0) } pub fn should_not_lint() -> ResInv { Ok(()) } type MyRes = Result<(A, B), Box>; pub fn should_not_lint2(x: i32) -> MyRes { Ok((x, ())) } } fn main() {}