Skip to content

Retain newlines when reordering imports #3814

Open
@ghost

Description

cargo-fmt did this:

diff --git a/async-await-echo/src/main.rs b/async-await-echo/src/main.rs
index 1531b22..a654e92 100644
--- a/async-await-echo/src/main.rs
+++ b/async-await-echo/src/main.rs
@@ -1,16 +1,4 @@
 use {
-    hyper::{
-        // Miscellaneous types from Hyper for working with HTTP.
-        Body, Client, Request, Response, Server, Uri,
-
-        // This function turns a closure which returns a future into an
-        // implementation of the the Hyper `Service` trait, which is an
-        // asynchronous function from a generic `Request` to a `Response`.
-        service::service_fn,
-
-        // A function which runs a future to completion using the Hyper runtime.
-        rt::run,
-    },
     futures::{
         // Extension trait for futures 0.1 futures, adding the `.compat()` method
         // which allows us to use `.await` on 0.1 futures.
@@ -20,6 +8,22 @@ use {
         // `TryFutureExt` adds methods to futures that return `Result` types.
         future::{FutureExt, TryFutureExt},
     },
+    hyper::{
+        // A function which runs a future to completion using the Hyper runtime.
+        rt::run,
+        // This function turns a closure which returns a future into an
+        // implementation of the the Hyper `Service` trait, which is an
+        // asynchronous function from a generic `Request` to a `Response`.
+        service::service_fn,
+
+        // Miscellaneous types from Hyper for working with HTTP.
+        Body,
+        Client,
+        Request,
+        Response,
+        Server,
+        Uri,
+    },
     std::net::SocketAddr,
 };
 

that rt::run, line could use an extra new line, me thinks.

rustfmt 1.4.8-nightly (6b0a447 2019-09-20)

code is from: https://rust-lang.github.io/async-book/01_getting_started/05_http_server_example.html

Thanks.

PS: someone could probably title this better to describe this case?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions