frondeus / test-case

Rust procedural macro attribute for adding test cases easily
MIT License
610 stars 38 forks source link

Nightly clippy raises warning "unneeded unit expression" #66

Closed emakryo closed 3 years ago

emakryo commented 3 years ago

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.

luke-biel commented 3 years ago

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