Skip to content

Commit

Permalink
Revert global fmt config and use rustfmt::skip
Browse files Browse the repository at this point in the history
  • Loading branch information
oxalica committed Jul 19, 2019
1 parent 2cc373a commit b70b3b1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 34 deletions.
2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ max_width = 120
comment_width = 100
match_block_trailing_comma = true
wrap_comments = true
edition = "2018"

error_on_line_overflow = true
54 changes: 29 additions & 25 deletions tests/ui/issue_4266.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,41 @@
#![feature(async_await)]
#![allow(dead_code)]

async fn sink1<'a>(_: &'a str) {} // lint
async fn sink1_elided(_: &str) {} // ok
// No edition 2018
#[rustfmt::skip]
mod m {
async fn sink1<'a>(_: &'a str) {} // lint
async fn sink1_elided(_: &str) {} // ok

// lint
async fn one_to_one<'a>(s: &'a str) -> &'a str {
s
}
// lint
async fn one_to_one<'a>(s: &'a str) -> &'a str {
s
}

// ok
async fn one_to_one_elided(s: &str) -> &str {
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
}
// 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
// async fn unrelated(_: &str, _: &str) {} // Not allowed in async fn

// #3988
struct Foo;
impl Foo {
// ok
pub async fn foo(&mut self) {}
}
// #3988
struct Foo;
impl Foo {
// ok
pub async fn foo(&mut self) {}
}

// rust-lang/rust#61115
// ok
async fn print(s: &str) {
println!("{}", s);
// rust-lang/rust#61115
// ok
async fn print(s: &str) {
println!("{}", s);
}
}

fn main() {}
16 changes: 8 additions & 8 deletions tests/ui/issue_4266.stderr
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/issue_4266.rs:5:1
--> $DIR/issue_4266.rs:8:5
|
LL | async fn sink1<'a>(_: &'a str) {} // lint
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | async fn sink1<'a>(_: &'a str) {} // lint
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::needless-lifetimes` implied by `-D warnings`

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
--> $DIR/issue_4266.rs:9:1
--> $DIR/issue_4266.rs:12:5
|
LL | / async fn one_to_one<'a>(s: &'a str) -> &'a str {
LL | | s
LL | | }
| |_^
LL | / async fn one_to_one<'a>(s: &'a str) -> &'a str {
LL | | s
LL | | }
| |_____^

error: aborting due to 2 previous errors

0 comments on commit b70b3b1

Please sign in to comment.