diff --git a/mockall/src/lib.rs b/mockall/src/lib.rs index 21803850..d30f53e2 100644 --- a/mockall/src/lib.rs +++ b/mockall/src/lib.rs @@ -668,8 +668,8 @@ //! } //! # fn main() {} //! ``` -//! For structs with more than one `impl` block, see [`mock!`] -//! instead. +//! For structs with more than one `impl` block or that have unsupported +//! `#[derive(X)]` attributes, e.g. `Clone`, see [`mock!`] instead. //! //! ## Generic methods //! @@ -1289,6 +1289,23 @@ pub use mockall_derive::automock; /// } /// # fn main() {} /// ``` +/// Mocking an unsupported `#[derive(X)]` attribute, e.g. `Clone`, is +/// similar. +/// ``` +/// # use mockall_derive::mock; +/// #[derive(Clone)] +/// struct MyStruct; +/// +/// mock!{ +/// pub MyStruct { +/// fn bar(&self); +/// } +/// impl Clone for MyStruct { +/// fn clone(&self) -> Self; +/// } +/// } +/// # fn main() {} +/// ``` /// /// When mocking a generic struct's implementation of a generic trait, use the /// same namespace for their generic parameters. For example, if you wanted to