diff --git a/ambassador/src/delegate_to_methods.rs b/ambassador/src/delegate_to_methods.rs index 69a4899..4a2940d 100644 --- a/ambassador/src/delegate_to_methods.rs +++ b/ambassador/src/delegate_to_methods.rs @@ -368,6 +368,7 @@ fn delegate_single_attr( if added_deref { res = quote! { + #[allow(clippy::unused_unit)] const _: () = { #[allow(unused_imports)] use ::core::ops::{Deref as _, DerefMut as _}; diff --git a/ambassador/tests/clippy-issue81.rs b/ambassador/tests/clippy-issue81.rs new file mode 100644 index 0000000..60f7b13 --- /dev/null +++ b/ambassador/tests/clippy-issue81.rs @@ -0,0 +1,13 @@ +//! Ensures that the `clippy::unused_unit` lint doesn't fire when . +//! +//! Only catches the error when run with clippy. +#![deny(clippy::unused_unit)] + +#[ambassador::delegatable_trait] +pub trait Shout { + fn shout(&self, input: &str) -> String; +} + +#[ambassador::delegate_to_remote_methods] // lint triggered here +#[delegate(Shout, target_ref = "deref")] +impl<'a, T: Shout> Shout for &'a T {}