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,5 +1,5 @@
use frame::Reason;
use proto::{MAX_WINDOW_SIZE, WindowSize};
use proto::{WindowSize, MAX_WINDOW_SIZE};
// We don't want to send WINDOW_UPDATE frames for tiny changes, but instead
// aggregate them when the changes are significant. Many implementations do
@@ -87,8 +87,7 @@ impl FlowControl {
}
let unclaimed = available - self.window_size;
let threshold = self.window_size / UNCLAIMED_DENOMINATOR
* UNCLAIMED_NUMERATOR;
let threshold = self.window_size / UNCLAIMED_DENOMINATOR * UNCLAIMED_NUMERATOR;
if unclaimed < threshold {
None
@@ -111,7 +110,10 @@ impl FlowControl {
return Err(Reason::FlowControlError);
}
trace!("inc_window; sz={}; old={}; new={}", sz, self.window_size, val);
trace!("inc_window; sz={}; old={}; new={}",
sz,
self.window_size,
val);
self.window_size = val;
Ok(())
@@ -130,7 +132,9 @@ impl FlowControl {
/// must ensure that the window has capacity.
pub fn send_data(&mut self, sz: WindowSize) {
trace!("send_data; sz={}; window={}; available={}",
sz, self.window_size, self.available);
sz,
self.window_size,
self.available);
// Ensure that the argument is correct
assert!(sz <= self.window_size as WindowSize);