Closed
Description
I tried this code:
trait Tr {
type Args;
fn do_it(args: Self::Args);
}
struct A;
impl Tr for A {
type Args = ();
fn do_it(_: Self::Args) {}
}
struct B;
impl Tr for B {
type Args = <A as Tr>::Args;
fn do_it(args: Self::Args) {
A::do_it(args)
}
}
I expected to see this happen: No lint trigger.
Instead, this happened:
warning: passing a unit value to a function
--> src/lib.rs:17:9
|
17 | A::do_it(args)
| ^^^^^^^^^^^^^^
|
= note: `#[warn(clippy::unit_arg)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
help: move the expression in front of the call and replace it with the unit literal `()`
|
17 | args;
18 | A::do_it(())
|
Meta
cargo clippy -V
: clippy 0.0.212 (7eac88abb 2020-11-16)rustc -Vv
:rustc 1.48.0 (7eac88abb 2020-11-16) binary: rustc commit-hash: 7eac88abb2e57e752f3302f02be5f3ce3d7adfb4 commit-date: 2020-11-16 host: x86_64-apple-darwin release: 1.48.0 LLVM version: 11.0
Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=00536070342bc4272bf55d028d065d03