Closed
Description
Lint name:
unit_arg
I tried this code:
#[rocket::get("/")]
fn handler() {}
fn main() {
println!("Hello, world!");
}
with the following Cargo.toml
:
[package]
name = "rocket-example"
version = "0.1.0"
edition = "2018"
[dependencies.rocket]
git = "https://github.com/SergioBenitez/Rocket.git"
rev = "9671115796e42865eaebd020ac27542802027b02"
I expected to see this happen: no warning
Instead, this happened:
warning: passing a unit value to a function
--> src/main.rs:2:4
|
2 | fn handler() {}
| ^^^^^^^
|
= 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 `()`
|
2 | fn handler;
3 | ()() {}
|
warning: 1 warning emitted
See also rwf2/Rocket#1495.
Meta
cargo clippy -V
: clippy 0.0.212 (2987785 2020-12-28)rustc -Vv
:rustc 1.51.0-nightly (2987785df 2020-12-28) binary: rustc commit-hash: 2987785df3d46d5ff144a5c67fbb8f5cca798d78 commit-date: 2020-12-28 host: x86_64-unknown-linux-gnu release: 1.51.0-nightly