blob: 23453207b4e5ede5a95afa043138fe3d590beb4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#![allow(dead_code)]
#![allow(clippy::uninlined_format_args)]
async fn sink1<'a>(_: &'a str) {} // lint
//~^ ERROR: the following explicit lifetimes could be elided: 'a
//~| NOTE: `-D clippy::needless-lifetimes` implied by `-D warnings`
async fn sink1_elided(_: &str) {} // ok
// lint
async fn one_to_one<'a>(s: &'a str) -> &'a str {
//~^ ERROR: the following explicit lifetimes could be elided: 'a
s
}
// ok
async fn one_to_one_elided(s: &str) -> &str {
s
}
// ok
async fn all_to_one<'a>(a: &'a str, _b: &'a str) -> &'a str {
a
}
// async fn unrelated(_: &str, _: &str) {} // Not allowed in async fn
// #3988
struct Foo;
impl Foo {
// ok
pub async fn new(&mut self) -> Self {
//~^ ERROR: methods called `new` usually take no `self`
Foo {}
}
}
// rust-lang/rust#61115
// ok
async fn print(s: &str) {
println!("{}", s);
}
fn main() {}
|