Skip to content

Commit 2cc373a

Browse files
committed
Fix fmt
1 parent e6bbed9 commit 2cc373a

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

rustfmt.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ max_width = 120
22
comment_width = 100
33
match_block_trailing_comma = true
44
wrap_comments = true
5-
5+
edition = "2018"
66
error_on_line_overflow = true

tests/ui/issue_4266.rs

+19-5
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,33 @@
55
async fn sink1<'a>(_: &'a str) {} // lint
66
async fn sink1_elided(_: &str) {} // ok
77

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
8+
// lint
9+
async fn one_to_one<'a>(s: &'a str) -> &'a str {
10+
s
11+
}
12+
13+
// ok
14+
async fn one_to_one_elided(s: &str) -> &str {
15+
s
16+
}
17+
18+
// ok
19+
async fn all_to_one<'a>(a: &'a str, _b: &'a str) -> &'a str {
20+
a
21+
}
22+
1123
// async fn unrelated(_: &str, _: &str) {} // Not allowed in async fn
1224

1325
// #3988
1426
struct Foo;
1527
impl Foo {
16-
pub async fn foo(&mut self) {} // ok
28+
// ok
29+
pub async fn foo(&mut self) {}
1730
}
1831

1932
// rust-lang/rust#61115
20-
async fn print(s: &str) { // ok
33+
// ok
34+
async fn print(s: &str) {
2135
println!("{}", s);
2236
}
2337

tests/ui/issue_4266.stderr

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ LL | async fn sink1<'a>(_: &'a str) {} // lint
77
= note: `-D clippy::needless-lifetimes` implied by `-D warnings`
88

99
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
10+
--> $DIR/issue_4266.rs:9:1
1111
|
12-
LL | async fn one_to_one<'a>(s: &'a str) -> &'a str { s } // lint
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
LL | / async fn one_to_one<'a>(s: &'a str) -> &'a str {
13+
LL | | s
14+
LL | | }
15+
| |_^
1416

1517
error: aborting due to 2 previous errors
1618

0 commit comments

Comments
 (0)