aa8a82ec26
---- UPDATE: add async block into test. FIX: no_effect Fixed asynchronous function parameter names with underscores so that warnings are not displayed when underscores are added to parameter names ADD: test case
51 lines
1.2 KiB
Rust
51 lines
1.2 KiB
Rust
#![warn(clippy::no_effect_underscore_binding)]
|
|
#![no_main]
|
|
|
|
trait AsyncTrait {
|
|
async fn bar(i: u64);
|
|
}
|
|
|
|
struct Bar;
|
|
|
|
impl AsyncTrait for Bar {
|
|
// Shouldn't lint `binding to `_` prefixed variable with no side-effect`
|
|
async fn bar(_i: u64) {
|
|
let _a = 0;
|
|
//~^ ERROR: binding to `_` prefixed variable with no side-effect
|
|
|
|
// Shouldn't lint `binding to `_` prefixed variable with no side-effect`
|
|
let _b = num();
|
|
|
|
let _ = async {
|
|
let _c = 0;
|
|
//~^ ERROR: binding to `_` prefixed variable with no side-effect
|
|
|
|
// Shouldn't lint `binding to `_` prefixed variable with no side-effect`
|
|
let _d = num();
|
|
}
|
|
.await;
|
|
}
|
|
}
|
|
|
|
// Shouldn't lint `binding to `_` prefixed variable with no side-effect`
|
|
async fn foo(_i: u64) {
|
|
let _a = 0;
|
|
//~^ ERROR: binding to `_` prefixed variable with no side-effect
|
|
|
|
// Shouldn't lint `binding to `_` prefixed variable with no side-effect`
|
|
let _b = num();
|
|
|
|
let _ = async {
|
|
let _c = 0;
|
|
//~^ ERROR: binding to `_` prefixed variable with no side-effect
|
|
|
|
// Shouldn't lint `binding to `_` prefixed variable with no side-effect`
|
|
let _d = num();
|
|
}
|
|
.await;
|
|
}
|
|
|
|
fn num() -> usize {
|
|
0
|
|
}
|