File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ // compile-flags: --edition 2018
2+ #![ feature( async_await) ]
3+ #![ allow( dead_code) ]
4+
5+ async fn sink1 < ' a > ( _: & ' a str ) { } // lint
6+ async fn sink1_elided ( _: & str ) { } // ok
7+
8+ async fn one_to_one < ' a > ( s : & ' a str ) -> & ' a str { s } // lint
9+ async fn one_to_one_elided ( s : & str ) -> & str { s } // ok
10+ async fn all_to_one < ' a > ( a : & ' a str , _b : & ' a str ) -> & ' a str { a } // ok
11+ // async fn unrelated(_: &str, _: &str) {} // Not allowed in async fn
12+
13+ // #3988
14+ struct Foo ;
15+ impl Foo {
16+ pub async fn foo ( & mut self ) { } // ok
17+ }
18+
19+ // rust-lang/rust#61115
20+ async fn print ( s : & str ) { // ok
21+ println ! ( "{}" , s) ;
22+ }
23+
24+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
2+ --> $DIR/issue_4266.rs:5:1
3+ |
4+ LL | async fn sink1<'a>(_: &'a str) {} // lint
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+ |
7+ = note: `-D clippy::needless-lifetimes` implied by `-D warnings`
8+
9+ error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
10+ --> $DIR/issue_4266.rs:8:1
11+ |
12+ LL | async fn one_to_one<'a>(s: &'a str) -> &'a str { s } // lint
13+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
15+ error: aborting due to 2 previous errors
16+
You can’t perform that action at this time.
0 commit comments