1 // Check "unused_lifetimes" lint on both async and sync functions
2 // Both cases should be diagnosed the same way.
6 #![deny(unused_lifetimes)]
8 async
fn async_wrong_without_args
<'a
>() {}
//~ ERROR lifetime parameter `'a` never used
10 async
fn async_wrong_1_lifetime
<'a
>(_
: &i32) {}
//~ ERROR lifetime parameter `'a` never used
12 async
fn async_wrong_2_lifetimes
<'a
, 'b
>(_
: &'a
i32, _
: &i32) {}
//~ ERROR lifetime parameter `'b` never used
14 async
fn async_right_1_lifetime
<'a
>(_
: &'a
i32) {}
16 async
fn async_right_2_lifetimes
<'a
, 'b
>(_
: &'a
i32, _
: &'b
i32) {}
18 async
fn async_right_trait_bound_lifetime
<'a
, I
>(_
: I
)
20 I
: Iterator
<Item
= &'a
i32>
23 fn wrong_without_args
<'a
>() {}
//~ ERROR lifetime parameter `'a` never used
25 fn wrong_1_lifetime
<'a
>(_
: &i32) {}
//~ ERROR lifetime parameter `'a` never used
27 fn wrong_2_lifetimes
<'a
, 'b
>(_
: &'a
i32, _
: &i32) {}
//~ ERROR lifetime parameter `'b` never used
29 fn right_1_lifetime
<'a
>(_
: &'a
i32) {}
31 fn right_2_lifetimes
<'a
, 'b
>(_
: &'a
i32, _
: &'b
i32) {}
33 fn right_trait_bound_lifetime
<'a
, I
>(_
: I
)
35 I
: Iterator
<Item
= &'a
i32>