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

@@ -3,9 +3,9 @@ use codec::UserError::*;
use frame::{self, Frame, FrameSize};
use hpack;
use bytes::{Buf, BufMut, BytesMut};
use futures::*;
use tokio_io::{AsyncRead, AsyncWrite};
use bytes::{BytesMut, Buf, BufMut};
use std::io::{self, Cursor};
@@ -51,8 +51,9 @@ const CHAIN_THRESHOLD: usize = 256;
// TODO: Make generic
impl<T, B> FramedWrite<T, B>
where T: AsyncWrite,
B: Buf,
where
T: AsyncWrite,
B: Buf,
{
pub fn new(inner: T) -> FramedWrite<T, B> {
FramedWrite {
@@ -72,7 +73,7 @@ impl<T, B> FramedWrite<T, B>
pub fn poll_ready(&mut self) -> Poll<(), io::Error> {
if !self.has_capacity() {
// Try flushing
try!(self.flush());
self.flush()?;
if !self.has_capacity() {
return Ok(Async::NotReady);
@@ -248,7 +249,8 @@ impl<T: io::Read, B> io::Read for FramedWrite<T, B> {
impl<T: AsyncRead, B> AsyncRead for FramedWrite<T, B> {
fn read_buf<B2: BufMut>(&mut self, buf: &mut B2) -> Poll<usize, io::Error>
where Self: Sized,
where
Self: Sized,
{
self.inner.read_buf(buf)
}