Skip to content

Commit

Permalink
Suppress "unused unit" warnings from Clippy in the generated code
Browse files Browse the repository at this point in the history
PR #148 fixed it for the master branch; this commit fixes it for the
2020_refactor branch.

Issue #142
  • Loading branch information
asomers committed Jul 29, 2020
1 parent 3435138 commit 255d8d1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mockall_derive/src/mock_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ impl ToTokens for MockItemModule {
};
quote!(
#docstr
// TODO: remove the allow unused_unit
// https://github.com/asomers/mockall/issues/149
#[allow(clippy::unused_unit)]
pub mod #modname {
#body
}).to_tokens(tokens);
Expand Down
6 changes: 6 additions & 0 deletions mockall_derive/src/mock_item_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ impl ToTokens for MockItemStruct {
let vis = &self.vis;
quote!(
#[allow(non_snake_case)]
// TODO: remove the allow unused_unit
// https://github.com/asomers/mockall/issues/149
#[allow(clippy::unused_unit)]
#[doc(hidden)]
pub mod #modname {
use super::*;
Expand Down Expand Up @@ -342,6 +345,9 @@ impl ToTokens for MockItemTraitImpl {
let priv_mods = self.methods.priv_mods();
quote!(
#[allow(non_snake_case)]
// TODO: remove the allow unused_unit
// https://github.com/asomers/mockall/issues/149
#[allow(clippy::unused_unit)]
#[doc(hidden)]
pub mod #modname {
use super::*;
Expand Down
1 change: 1 addition & 0 deletions mockall_derive/src/mockable_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ impl From<(Attrs, ItemForeignMod)> for MockableModule {
// Add an explicit "-> ()" for perfect
// compatibility with 0.7.0. TODO: remove this
// after merging the 2020_refactor branch
// https://github.com/asomers/mockall/issues/149
let rarrow = Token![->](sig.output.span());
let unit = Type::Tuple(TypeTuple{
paren_token: token::Paren::default(),
Expand Down

0 comments on commit 255d8d1

Please sign in to comment.