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

Nightly clippy raises warning "unneeded unit expression" #66

Closed
emakryo opened this issue May 31, 2021 · 1 comment
Closed

Nightly clippy raises warning "unneeded unit expression" #66

emakryo opened this issue May 31, 2021 · 1 comment

Comments

@emakryo
Copy link

emakryo commented May 31, 2021

  • test-case version: 1.1.0
  • rustc & clippy version: 1.54.0-nightly (c1e8f3a58 2021-05-30)

Clippy raises a warning to the following code.

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

    #[test_case(1, 1)]
    fn square(x: i32, y: i32) {
        assert_eq!(x*x, y);
    }
}

Messages from clippy,

warning: unneeded unit expression
 --> src/main.rs:9:5
  |
9 |     #[test_case(1, 1)]
  |     ^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(clippy::unused_unit)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit
  = note: this warning originates in the attribute macro `test_case` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: 1 warning emitted

I think this warning should be suppressed in macro, or we should modify the macro not to use unit expressions, if possible.

martinvonz added a commit to martinvonz/test-case that referenced this issue Jun 15, 2021
It seems that `quote!` implements `ToTokens` for `Option` such that we
can use a `Option<Expr>` for optionally emitting #expected here.
martinvonz added a commit to martinvonz/jj that referenced this issue Jun 26, 2021
This is work around frondeus/test-case#66 until my pull request (or
other fix) gets accepted.
luke-biel added a commit that referenced this issue Jun 27, 2021
Avoid emitting "unneeded unit expression" (issue #66)
@luke-biel
Copy link
Collaborator

This should be fixed in 1.2.0, i'll take liberty of closing this Issue.

martinvonz added a commit to martinvonz/jj that referenced this issue Jun 29, 2021
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