]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/used_underscore_binding.rs
Test that we lint the awaited expression
[rust.git] / tests / ui / used_underscore_binding.rs
index 5a02ff5d193de27d073f7a7bfd428240f48c5e27..8e0243c49aaa038405796a66695a6f264f38b569 100644 (file)
@@ -1,5 +1,7 @@
+// edition:2018
 // aux-build:proc_macro_derive.rs
 
+#![feature(rustc_private)]
 #![warn(clippy::all)]
 #![allow(clippy::blacklisted_name)]
 #![warn(clippy::used_underscore_binding)]
@@ -86,6 +88,21 @@ fn non_variables() {
     f();
 }
 
+// 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() {
     let foo = 0u32;
     // tests of unused_underscore lint
@@ -98,4 +115,5 @@ fn main() {
     let _ = unused_underscore_complex(foo);
     let _ = multiple_underscores(foo);
     non_variables();
+    await_desugaring();
 }