about summary refs log tree commit diff
diff options
context:
space:
mode:
authoruHOOCCOOHu <hooccooh1896@gmail.com>2019-07-20 00:50:18 +0800
committeruHOOCCOOHu <hooccooh1896@gmail.com>2019-07-20 00:50:18 +0800
commitb70b3b14aa3125fe4f74a6a71fb7a7b7e78ab13f (patch)
tree367b25e1b49339278cf9d1c295127fba273ee296
parent2cc373ac54e7d244cea22b305cefc1c2d08d81f6 (diff)
downloadrust-b70b3b14aa3125fe4f74a6a71fb7a7b7e78ab13f.tar.gz
rust-b70b3b14aa3125fe4f74a6a71fb7a7b7e78ab13f.zip
Revert global fmt config and use `rustfmt::skip`
-rw-r--r--rustfmt.toml2
-rw-r--r--tests/ui/issue_4266.rs54
-rw-r--r--tests/ui/issue_4266.stderr16
3 files changed, 38 insertions, 34 deletions
diff --git a/rustfmt.toml b/rustfmt.toml
index f1241e74b0a..797eccdad99 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -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
diff --git a/tests/ui/issue_4266.rs b/tests/ui/issue_4266.rs
index 953879f7bed..737e718c4c0 100644
--- a/tests/ui/issue_4266.rs
+++ b/tests/ui/issue_4266.rs
@@ -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() {}
diff --git a/tests/ui/issue_4266.stderr b/tests/ui/issue_4266.stderr
index 8b4e70eb9c2..649d01dca1e 100644
--- a/tests/ui/issue_4266.stderr
+++ b/tests/ui/issue_4266.stderr
@@ -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