Skip to content

Commit

Permalink
Merge pull request #554 from asomers/clippy-24-feb-2023
Browse files Browse the repository at this point in the history
Clippy cleanup
  • Loading branch information
asomers authored Feb 24, 2024
2 parents cdc5794 + 8d40790 commit a947db4
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 16 deletions.
2 changes: 1 addition & 1 deletion mockall/tests/anyhow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn Ok<T>(t: T) -> Result<T> {
pub type Result<T, E = Error> = std::result::Result<T, E>;

#[automock]
trait Foo {
pub trait Foo {
fn foo(&self) -> Result<(), Error>;
fn reffoo(&self) -> &Result<(), Error>;
fn refmutfoo(&mut self) -> &mut Result<(), Error>;
Expand Down
2 changes: 1 addition & 1 deletion mockall/tests/automock_extern_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extern crate std;
use mockall::*;

#[automock]
trait SimpleTrait {
pub trait SimpleTrait {
fn foo(&self, x: u32) -> u32;
}

Expand Down
2 changes: 1 addition & 1 deletion mockall/tests/automock_multiple_lifetime_parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
use mockall::*;

#[automock]
trait Foo {
pub trait Foo {
fn foo<'a, 'b, 'c, 'd, 'e, 'f>(&self, x: &'a &'b &'c &'d &'e &'f i32);
}
2 changes: 1 addition & 1 deletion mockall/tests/automock_send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use mockall::*;

#[automock]
trait T {
pub trait T {
fn foo(&self) -> u32;
}

Expand Down
4 changes: 2 additions & 2 deletions mockall/tests/mock_cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use mockall::*;
// For this test, use the "nightly" feature as the cfg gate, because it's tested
// both ways in CI.
#[cfg(feature = "nightly")]
trait Beez {
pub trait Beez {
fn beez(&self);
}
#[cfg(not(feature = "nightly"))]
trait Beez {
pub trait Beez {
fn beez(&self, x: i32) -> i32;
}

Expand Down
2 changes: 1 addition & 1 deletion mockall/tests/mock_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use mockall::*;
// ensures that the code will compile. mockall_derive has a unit test to ensure
// that the doc comments are correctly placed.

trait Tr {
pub trait Tr {
fn bar(&self);
}

Expand Down
30 changes: 27 additions & 3 deletions mockall_derive/src/mock_function.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
// vim: tw=80
use super::*;

use quote::ToTokens;
use proc_macro2::{Span, TokenStream};
use quote::{ToTokens, format_ident, quote};
use syn::{
*,
punctuated::Punctuated,
spanned::Spanned
};


use crate::{
AttrFormatter,
HashSet,
compile_error,
concretize_args,
declosurefy,
expectation_visibility,
gen_keyid,
is_concretize,
lifetimes_to_generic_params,
lifetimes_to_generics,
merge_generics,
pat_is_self,
split_lifetimes,
staticize,
supersuperfy,
supersuperfy_generics,
};

/// Convert a trait object reference into a reference to a Boxed trait
///
Expand Down
11 changes: 9 additions & 2 deletions mockall_derive/src/mock_item.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
// vim: tw=80
use super::*;
use proc_macro2::{TokenStream};
use quote::{ToTokens, quote};
use syn::{
*,
spanned::Spanned
};

use crate::{
mock_function::MockFunction,
MockItemStruct,
compile_error,
mock_function::{self, MockFunction},
mockable_item::{MockableItem, MockableModule}
};

Expand Down
16 changes: 12 additions & 4 deletions mockall_derive/src/mock_item_struct.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
// vim: tw=80
use super::*;

use quote::ToTokens;
use std::collections::HashSet;

use proc_macro2::TokenStream;
use quote::{ToTokens, format_ident, quote};
use syn::{
*,
spanned::Spanned
};

use crate::{
mock_function::MockFunction,
AttrFormatter,
MockableStruct,
compile_error,
gen_mod_ident,
mock_function::{self, MockFunction},
mock_trait::MockTrait
};

Expand Down

0 comments on commit a947db4

Please sign in to comment.