mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Test that we lint the awaited expression
This commit is contained in:
parent
3a96f548d1
commit
fc5fc6378c
2 changed files with 18 additions and 3 deletions
|
@ -87,11 +87,20 @@ fn non_variables() {
|
|||
let f = _fn_test;
|
||||
f();
|
||||
}
|
||||
// Tests that we do not lint if the binding comes from await desugaring.
|
||||
// See issue 5360.
|
||||
|
||||
// Tests that we do not lint if the binding comes from await desugaring,
|
||||
// but we do lint the awaited expression. See issue 5360.
|
||||
async fn await_desugaring() {
|
||||
async fn foo() {}
|
||||
fn uses_i(_i: i32) {}
|
||||
|
||||
foo().await;
|
||||
({
|
||||
let _i = 5;
|
||||
uses_i(_i);
|
||||
foo()
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -30,5 +30,11 @@ error: used binding `_underscore_field` which is prefixed with an underscore. A
|
|||
LL | s._underscore_field += 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: used binding `_i` which is prefixed with an underscore. A leading underscore signals that a binding will not be used.
|
||||
--> $DIR/used_underscore_binding.rs:100:16
|
||||
|
|
||||
LL | uses_i(_i);
|
||||
| ^^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue