Use rustfmt to enforce consistent formatting

This change adds a .rustfmt.toml that includes ALL supported settings,
12 of which we have overridden to attempt to cater to our own
proclivities.

rustfmt is checked in the rust-nightly CI job.
This commit is contained in:
Oliver Gould
2017-09-08 17:20:41 +00:00
parent 93925e6d1f
commit 897bf84163
60 changed files with 2087 additions and 1620 deletions

View File

@@ -1,19 +1,19 @@
extern crate bytes;
extern crate env_logger;
extern crate futures;
extern crate h2;
extern crate http;
extern crate bytes;
extern crate futures;
extern crate tokio_core;
extern crate io_dump;
extern crate env_logger;
extern crate tokio_core;
use h2::client::{Client, Body};
use h2::client::{Body, Client};
use http::*;
use futures::*;
use bytes::*;
use futures::*;
use http::*;
use tokio_core::reactor;
use tokio_core::net::TcpStream;
use tokio_core::reactor;
struct Process {
body: Body<Bytes>,
@@ -49,52 +49,51 @@ impl Future for Process {
pub fn main() {
let _ = env_logger::init();
let mut core = reactor::Core::new().unwrap();;
let mut core = reactor::Core::new().unwrap();
let handle = core.handle();
let tcp = TcpStream::connect(
&"127.0.0.1:5928".parse().unwrap(),
&handle);
let tcp = TcpStream::connect(&"127.0.0.1:5928".parse().unwrap(), &handle);
let tcp = tcp.then(|res| {
let tcp = io_dump::Dump::to_stdout(res.unwrap());
Client::handshake(tcp)
})
.then(|res| {
let mut client = res.unwrap();
}).then(|res| {
let mut client = res.unwrap();
println!("sending request");
println!("sending request");
let request = Request::builder()
.uri("https://http2.akamai.com/")
.body(()).unwrap();
let request = Request::builder()
.uri("https://http2.akamai.com/")
.body(())
.unwrap();
let mut trailers = HeaderMap::new();
trailers.insert("zomg", "hello".parse().unwrap());
let mut trailers = HeaderMap::new();
trailers.insert("zomg", "hello".parse().unwrap());
let mut stream = client.request(request, false).unwrap();
let mut stream = client.request(request, false).unwrap();
// send trailers
stream.send_trailers(trailers).unwrap();
// send trailers
stream.send_trailers(trailers).unwrap();
// Spawn a task to run the client...
handle.spawn(client.map_err(|e| println!("GOT ERR={:?}", e)));
// Spawn a task to run the client...
handle.spawn(client.map_err(|e| println!("GOT ERR={:?}", e)));
stream.and_then(|response| {
println!("GOT RESPONSE: {:?}", response);
stream
.and_then(|response| {
println!("GOT RESPONSE: {:?}", response);
// Get the body
let (_, body) = response.into_parts();
// Get the body
let (_, body) = response.into_parts();
Process {
body,
trailers: false,
}
}).map_err(|e| {
println!("GOT ERR={:?}", e);
})
})
;
Process {
body,
trailers: false,
}
})
.map_err(|e| {
println!("GOT ERR={:?}", e);
})
});
core.run(tcp).unwrap();
}