about summary refs log tree commit diff
diff options
context:
space:
mode:
authoruHOOCCOOHu <hooccooh1896@gmail.com>2019-07-19 23:03:34 +0800
committeruHOOCCOOHu <hooccooh1896@gmail.com>2019-07-19 23:03:34 +0800
commit2cc373ac54e7d244cea22b305cefc1c2d08d81f6 (patch)
tree2047ac7bdbaafdd2227d71f50c3157a6cb56492e
parente6bbed909ee516b5e50bfb1a3b2b86a6b2988bc3 (diff)
downloadrust-2cc373ac54e7d244cea22b305cefc1c2d08d81f6.tar.gz
rust-2cc373ac54e7d244cea22b305cefc1c2d08d81f6.zip
Fix fmt
-rw-r--r--rustfmt.toml2
-rw-r--r--tests/ui/issue_4266.rs24
-rw-r--r--tests/ui/issue_4266.stderr8
3 files changed, 25 insertions, 9 deletions
diff --git a/rustfmt.toml b/rustfmt.toml
index 797eccdad99..f1241e74b0a 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 dbf482ea11a..953879f7bed 100644
--- a/tests/ui/issue_4266.rs
+++ b/tests/ui/issue_4266.rs
@@ -5,19 +5,33 @@
 async fn sink1<'a>(_: &'a str) {} // lint
 async fn sink1_elided(_: &str) {} // ok
 
-async fn one_to_one<'a>(s: &'a str) -> &'a str { s } // lint
-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
+// 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 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 {
-    pub async fn foo(&mut self) {} // ok
+    // ok
+    pub async fn foo(&mut self) {}
 }
 
 // rust-lang/rust#61115
-async fn print(s: &str) { // ok
+// ok
+async fn print(s: &str) {
     println!("{}", s);
 }
 
diff --git a/tests/ui/issue_4266.stderr b/tests/ui/issue_4266.stderr
index 3c9740c4a22..8b4e70eb9c2 100644
--- a/tests/ui/issue_4266.stderr
+++ b/tests/ui/issue_4266.stderr
@@ -7,10 +7,12 @@ 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:8:1
+  --> $DIR/issue_4266.rs:9:1
    |
-LL | async fn one_to_one<'a>(s: &'a str) -> &'a str { s } // lint
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / async fn one_to_one<'a>(s: &'a str) -> &'a str {
+LL | |     s
+LL | | }
+   | |_^
 
 error: aborting due to 2 previous errors