Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't mock Option<&str> without an explicit lifetime name #82

Closed
olvyko opened this issue Nov 21, 2019 · 1 comment
Closed

Can't mock Option<&str> without an explicit lifetime name #82

olvyko opened this issue Nov 21, 2019 · 1 comment

Comments

@olvyko
Copy link

olvyko commented Nov 21, 2019

Can't mock trait with Option<&str> without an explicit lifetime name:

#[cfg(test)]
mod tests {
    use mockall::*;

    #[automock]
    pub trait Mailer {
        fn send(&self, email: Option<&str>);
    }
}

Error:

error[E0637]: `&` without an explicit lifetime name cannot be used here
  --> modules\user\src\services\entry\usecase.rs:32:38
   |
32 |         fn send(&self, email: Option<&str>);
   |                                      ^ explicit lifetime name needed here

error[E0106]: missing lifetime specifier
  --> modules\user\src\services\entry\usecase.rs:32:38
   |
32 |         fn send(&self, email: Option<&str>);
   |                                      ^ expected lifetime parameter
@asomers
Copy link
Owner

asomers commented Nov 21, 2019

Duplicate of #61 .

@asomers asomers closed this as completed Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants