rustfmt: add trailing commas in match arms, set fn call to block stle (#85)

This commit is contained in:
Sean McArthur
2017-09-12 19:29:06 -07:00
committed by Carl Lerche
parent de1edf4873
commit f7d14861e5
37 changed files with 894 additions and 973 deletions

View File

@@ -121,11 +121,11 @@ impl Data<Bytes> {
};
Ok(Data {
stream_id: head.stream_id(),
data: payload,
flags: flags,
pad_len: pad_len,
})
stream_id: head.stream_id(),
data: payload,
flags: flags,
pad_len: pad_len,
})
}
}

View File

@@ -35,9 +35,9 @@ impl GoAway {
let error_code = unpack_octets_4!(payload, 4, u32);
Ok(GoAway {
last_stream_id: last_stream_id,
error_code: error_code,
})
last_stream_id: last_stream_id,
error_code: error_code,
})
}
pub fn encode<B: BufMut>(&self, dst: &mut B) {

View File

@@ -218,7 +218,7 @@ impl Headers {
reg = true;
self.fields.append(name, value);
}
}
},
Authority(v) => set_pseudo!(authority, v),
Method(v) => set_pseudo!(method, v),
Scheme(v) => set_pseudo!(scheme, v),
@@ -285,13 +285,11 @@ impl Headers {
let ret = match encoder.encode(None, &mut headers, dst) {
hpack::Encode::Full => None,
hpack::Encode::Partial(state) => {
Some(Continuation {
stream_id: self.stream_id,
hpack: state,
headers: headers,
})
}
hpack::Encode::Partial(state) => Some(Continuation {
stream_id: self.stream_id,
hpack: state,
headers: headers,
}),
};
// Compute the frame length
@@ -336,10 +334,10 @@ impl PushPromise {
let (promised_id, _) = StreamId::parse(&payload[..4]);
Ok(PushPromise {
stream_id: head.stream_id(),
promised_id: promised_id,
flags: flags,
})
stream_id: head.stream_id(),
promised_id: promised_id,
flags: flags,
})
}
pub fn stream_id(&self) -> StreamId {

View File

@@ -69,9 +69,9 @@ impl Ping {
let ack = head.flag() & ACK_FLAG != 0;
Ok(Ping {
ack,
payload,
})
ack,
payload,
})
}
pub fn encode<B: BufMut>(&self, dst: &mut B) {

View File

@@ -29,9 +29,9 @@ impl Priority {
}
Ok(Priority {
stream_id: head.stream_id(),
dependency: dependency,
})
stream_id: head.stream_id(),
dependency: dependency,
})
}
}

View File

@@ -40,7 +40,7 @@ impl Reason {
ConnectError => {
"connection established in response to a CONNECT request \
was reset or abnormally closed"
}
},
EnhanceYourCalm => "detected excessive load generating behavior",
InadequateSecurity => "security properties do not meet minimum requirements",
Http11Required => "endpoint requires HTTP/1.1",

View File

@@ -32,15 +32,17 @@ impl Reset {
let error_code = unpack_octets_4!(payload, 0, u32);
Ok(Reset {
stream_id: head.stream_id(),
error_code: error_code,
})
stream_id: head.stream_id(),
error_code: error_code,
})
}
pub fn encode<B: BufMut>(&self, dst: &mut B) {
trace!("encoding RESET; id={:?} code={}",
self.stream_id,
self.error_code);
trace!(
"encoding RESET; id={:?} code={}",
self.stream_id,
self.error_code
);
let head = Head::new(Kind::Reset, 0, self.stream_id);
head.encode(4, dst);
dst.put_u32::<BigEndian>(self.error_code);

View File

@@ -109,38 +109,34 @@ impl Settings {
match Setting::load(raw) {
Some(HeaderTableSize(val)) => {
settings.header_table_size = Some(val);
}
Some(EnablePush(val)) => {
match val {
0 | 1 => {
settings.enable_push = Some(val);
}
_ => {
return Err(Error::InvalidSettingValue);
}
}
}
},
Some(EnablePush(val)) => match val {
0 | 1 => {
settings.enable_push = Some(val);
},
_ => {
return Err(Error::InvalidSettingValue);
},
},
Some(MaxConcurrentStreams(val)) => {
settings.max_concurrent_streams = Some(val);
}
Some(InitialWindowSize(val)) => {
if val as usize > MAX_INITIAL_WINDOW_SIZE {
return Err(Error::InvalidSettingValue);
} else {
settings.initial_window_size = Some(val);
}
}
},
Some(InitialWindowSize(val)) => if val as usize > MAX_INITIAL_WINDOW_SIZE {
return Err(Error::InvalidSettingValue);
} else {
settings.initial_window_size = Some(val);
},
Some(MaxFrameSize(val)) => {
if val < DEFAULT_MAX_FRAME_SIZE || val as usize > MAX_MAX_FRAME_SIZE {
return Err(Error::InvalidSettingValue);
} else {
settings.max_frame_size = Some(val);
}
}
},
Some(MaxHeaderListSize(val)) => {
settings.max_header_list_size = Some(val);
}
None => {}
},
None => {},
}
}

View File

@@ -42,9 +42,9 @@ impl WindowUpdate {
}
Ok(WindowUpdate {
stream_id: head.stream_id(),
size_increment,
})
stream_id: head.stream_id(),
size_increment,
})
}
pub fn encode<B: BufMut>(&self, dst: &mut B) {