-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suppress clippy::too_many_arguments warnings in the generated code
This warning has always been possible, but it was particularly annoying when the user mocks a static function with seven arguments. Because in that case, some of the generated code will have eight arguments, triggering the warning even though the original code did not. Fixes #480
- Loading branch information
Showing
4 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
# I use a lot of dumb names in the tests | ||
disallowed-names = [] | ||
|
||
# Default is 7. Lock it there, so a change to the default value doesn't break | ||
# the automock_seven_args test. | ||
too-many-arguments-threshold = 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// vim: tw=80 | ||
//! When mocking static functions just at the threshold of Clippy's type | ||
//! complexity limit, no warnings should be emitted regarding the generated | ||
//! code. | ||
#![deny(warnings)] | ||
|
||
use mockall::automock; | ||
|
||
#[automock] | ||
trait ManyArgs { | ||
fn foo(_a0: u8, _a1: u8, _a2: u8, _a3: u8, _a4: u8, _a5: u8, _a6: u8); | ||
} | ||
|
||
#[test] | ||
fn static_method_returning() { | ||
let ctx = MockManyArgs::foo_context(); | ||
ctx.expect() | ||
.returning(|_, _, _, _, _, _, _| ()); | ||
MockManyArgs::foo(0, 0, 0, 0, 0, 0, 0); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters