Closed asomers closed 7 months ago
@tgnottingham does this branch work for you?
@asomers -- yes, it works for my use case! Thanks for the quick fix!
This hasn't affected me yet in practice, but I noticed that there are still some warnings emitted for #[must_use]
(regardless of whether or not there's a default method implementation):
#[mockall::automock]
trait Foo {
#[must_use]
fn foo(&self) -> i32;
}
fn main() {}
On Rust 1.76.0:
warning: `#[must_use]` has no effect when applied to a struct field
--> src/main.rs:3:5
|
3 | #[must_use]
| ^^^^^^^^^^^
|
= note: `#[warn(unused_attributes)]` on by default
warning: `#[must_use]` has no effect when applied to a struct field
--> src/main.rs:3:5
|
3 | #[must_use]
| ^^^^^^^^^^^
warning: `#[must_use]` has no effect when applied to an expression
--> src/main.rs:3:5
|
3 | #[must_use]
| ^^^^^^^^^^^
warning: unused attribute
--> src/main.rs:3:5
|
3 | #[must_use]
| ^^^^^^^^^^^ help: remove this attribute
|
note: attribute also specified here
--> src/main.rs:1:1
|
1 | #[mockall::automock]
| ^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: this warning originates in the attribute macro `mockall::automock` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: `#[must_use]` has no effect when applied to a module
--> src/main.rs:3:5
|
3 | #[must_use]
| ^^^^^^^^^^^
Without the &self
parameter on foo
, only the no effect when applied to a module
warning is generated.
@tgnottingham I cannot reproduce those warnings. Are you sure that you're using the "inline" branch?
My mistake, I was on the first commit to that branch. Everything works great on the second commit. Thanks again!
Fixes #552