Disallow nightly failures (#115)

Always install rustfmt since nightly may change underneath it, causing
linking to break.

Apply rustfmt
This commit is contained in:
Oliver Gould
2017-09-24 19:25:50 -07:00
committed by Sean McArthur
parent a72a6bc8f0
commit dad113e17b
10 changed files with 34 additions and 53 deletions

View File

@@ -28,8 +28,8 @@ after_success:
- cargo tarpaulin --out Xml -- --skip hpack && bash <(curl -s https://codecov.io/bash) - cargo tarpaulin --out Xml -- --skip hpack && bash <(curl -s https://codecov.io/bash)
jobs: jobs:
allow_failures: # allow_failures:
- rust: nightly # - rust: nightly
include: include:
- stage: docs - stage: docs
script: cargo doc --no-deps script: cargo doc --no-deps
@@ -47,7 +47,7 @@ jobs:
after_success: skip after_success: skip
- stage: fmt - stage: fmt
rust: nightly rust: nightly
install: if ! cargo fmt --help >/dev/null 2>&1 ; then cargo install rustfmt-nightly ; fi install: cargo install --force rustfmt-nightly
script: cargo fmt -- --write-mode=diff script: cargo fmt -- --write-mode=diff
after_success: skip after_success: skip

View File

@@ -187,7 +187,10 @@ impl Builder {
#[cfg(feature = "unstable")] #[cfg(feature = "unstable")]
pub fn initial_stream_id(&mut self, stream_id: u32) -> &mut Self { pub fn initial_stream_id(&mut self, stream_id: u32) -> &mut Self {
self.stream_id = stream_id.into(); self.stream_id = stream_id.into();
assert!(self.stream_id.is_client_initiated(), "stream id must be odd"); assert!(
self.stream_id.is_client_initiated(),
"stream id must be odd"
);
self self
} }

View File

@@ -148,8 +148,8 @@ impl<T> FramedRead<T> {
let _ = bytes.split_to(frame::HEADER_LEN); let _ = bytes.split_to(frame::HEADER_LEN);
// Parse the frame w/o parsing the payload // Parse the frame w/o parsing the payload
let (mut push, payload) = frame::PushPromise::load(head, bytes) let (mut push, payload) =
.map_err(|_| Connection(ProtocolError))?; frame::PushPromise::load(head, bytes).map_err(|_| Connection(ProtocolError))?;
if push.is_end_headers() { if push.is_end_headers() {
// Load the HPACK encoded headers & return the frame // Load the HPACK encoded headers & return the frame
@@ -174,7 +174,6 @@ impl<T> FramedRead<T> {
return Ok(None); return Ok(None);
} }
}, },
Kind::Priority => { Kind::Priority => {
if head.stream_id() == 0 { if head.stream_id() == 0 {
@@ -313,7 +312,11 @@ impl Continuable {
} }
} }
fn load_hpack(&mut self, src: BytesMut, decoder: &mut hpack::Decoder) -> Result<(), frame::Error> { fn load_hpack(
&mut self,
src: BytesMut,
decoder: &mut hpack::Decoder,
) -> Result<(), frame::Error> {
match *self { match *self {
Continuable::Headers(ref mut h) => h.load_hpack(src, decoder), Continuable::Headers(ref mut h) => h.load_hpack(src, decoder),
Continuable::PushPromise(ref mut p) => p.load_hpack(src, decoder), Continuable::PushPromise(ref mut p) => p.load_hpack(src, decoder),

View File

@@ -61,7 +61,7 @@ where
pub fn new( pub fn new(
codec: Codec<T, Prioritized<B::Buf>>, codec: Codec<T, Prioritized<B::Buf>>,
settings: &frame::Settings, settings: &frame::Settings,
next_stream_id: frame::StreamId next_stream_id: frame::StreamId,
) -> Connection<T, P, B> { ) -> Connection<T, P, B> {
let streams = Streams::new(streams::Config { let streams = Streams::new(streams::Config {
local_init_window_sz: settings local_init_window_sz: settings

View File

@@ -154,8 +154,8 @@ where
} }
if !stream.content_length.is_head() { if !stream.content_length.is_head() {
use http::header;
use super::stream::ContentLength; use super::stream::ContentLength;
use http::header;
if let Some(content_length) = frame.fields().get(header::CONTENT_LENGTH) { if let Some(content_length) = frame.fields().get(header::CONTENT_LENGTH) {
let content_length = match parse_u64(content_length.as_bytes()) { let content_length = match parse_u64(content_length.as_bytes()) {

View File

@@ -199,8 +199,8 @@ where
// There are no more outstanding references to the stream // There are no more outstanding references to the stream
self.ref_count == 0 && self.ref_count == 0 &&
// The stream is not in any queue // The stream is not in any queue
!self.is_pending_send && !self.is_pending_send_capacity && !self.is_pending_send && !self.is_pending_send_capacity
!self.is_pending_accept && !self.is_pending_window_update && !self.is_pending_accept && !self.is_pending_window_update
} }
pub fn assign_capacity(&mut self, capacity: WindowSize) { pub fn assign_capacity(&mut self, capacity: WindowSize) {

View File

@@ -324,8 +324,8 @@ where
request: Request<()>, request: Request<()>,
end_of_stream: bool, end_of_stream: bool,
) -> Result<StreamRef<B, P>, SendError> { ) -> Result<StreamRef<B, P>, SendError> {
use http::Method;
use super::stream::ContentLength; use super::stream::ContentLength;
use http::Method;
// TODO: There is a hazard with assigning a stream ID before the // TODO: There is a hazard with assigning a stream ID before the
// prioritize layer. If prioritization reorders new streams, this // prioritize layer. If prioritization reorders new streams, this

View File

@@ -75,9 +75,7 @@ fn request_stream_id_overflows() {
.unwrap(); .unwrap();
// first request is allowed // first request is allowed
let req = h2.send_request(request, true) let req = h2.send_request(request, true).unwrap().unwrap();
.unwrap()
.unwrap();
let request = Request::builder() let request = Request::builder()
.method(Method::GET) .method(Method::GET)
@@ -117,17 +115,12 @@ fn request_over_max_concurrent_streams_errors() {
let (io, srv) = mock::new(); let (io, srv) = mock::new();
let srv = srv.assert_client_handshake_with_settings( let srv = srv.assert_client_handshake_with_settings(frames::settings()
frames::settings()
// super tiny server // super tiny server
.max_concurrent_streams(1) .max_concurrent_streams(1))
)
.unwrap() .unwrap()
.recv_settings() .recv_settings()
.recv_frame( .recv_frame(frames::headers(1).request("POST", "https://example.com/"))
frames::headers(1)
.request("POST", "https://example.com/")
)
.send_frame(frames::headers(1).response(200)) .send_frame(frames::headers(1).response(200))
.close(); .close();
@@ -141,15 +134,12 @@ fn request_over_max_concurrent_streams_errors() {
.unwrap(); .unwrap();
// first request is allowed // first request is allowed
let req = h2.send_request(request, false) let req = h2.send_request(request, false).unwrap().unwrap();
.unwrap()
.unwrap();
// drive the connection some so we can receive the server settings // drive the connection some so we can receive the server settings
h2.drive(req) h2.drive(req)
}) })
.and_then(|(mut h2, _)| { .and_then(|(mut h2, _)| {
let request = Request::builder() let request = Request::builder()
.method(Method::GET) .method(Method::GET)
.uri("https://example.com/") .uri("https://example.com/")

View File

@@ -380,17 +380,12 @@ fn stream_close_by_data_frame_releases_capacity() {
h2.unwrap() h2.unwrap()
}); });
let srv = srv.assert_client_handshake().unwrap() let srv = srv.assert_client_handshake()
.unwrap()
.recv_settings() .recv_settings()
.recv_frame( .recv_frame(frames::headers(1).request("POST", "https://http2.akamai.com/"))
frames::headers(1)
.request("POST", "https://http2.akamai.com/")
)
.send_frame(frames::headers(1).response(200)) .send_frame(frames::headers(1).response(200))
.recv_frame( .recv_frame(frames::headers(3).request("POST", "https://http2.akamai.com/"))
frames::headers(3)
.request("POST", "https://http2.akamai.com/")
)
.send_frame(frames::headers(3).response(200)) .send_frame(frames::headers(3).response(200))
.recv_frame(frames::data(1, &b""[..]).eos()) .recv_frame(frames::data(1, &b""[..]).eos())
.recv_frame(frames::data(3, &b"hello"[..]).eos()) .recv_frame(frames::data(3, &b"hello"[..]).eos())
@@ -536,9 +531,7 @@ fn recv_window_update_on_stream_closed_by_data_frame() {
let srv = srv.assert_client_handshake() let srv = srv.assert_client_handshake()
.unwrap() .unwrap()
.recv_settings() .recv_settings()
.recv_frame( .recv_frame(frames::headers(1).request("POST", "https://http2.akamai.com/"))
frames::headers(1).request("POST", "https://http2.akamai.com/"),
)
.send_frame(frames::headers(1).response(200)) .send_frame(frames::headers(1).response(200))
.recv_frame(frames::data(1, "hello").eos()) .recv_frame(frames::data(1, "hello").eos())
.send_frame(frames::window_update(1, 5)) .send_frame(frames::window_update(1, 5))
@@ -631,8 +624,8 @@ fn reserved_capacity_assigned_in_multi_window_updates() {
#[test] #[test]
fn connection_notified_on_released_capacity() { fn connection_notified_on_released_capacity() {
use futures::sync::oneshot; use futures::sync::oneshot;
use std::thread;
use std::sync::mpsc; use std::sync::mpsc;
use std::thread;
let _ = ::env_logger::init(); let _ = ::env_logger::init();
let (io, srv) = mock::new(); let (io, srv) = mock::new();
@@ -685,15 +678,11 @@ fn connection_notified_on_released_capacity() {
let (mut h2, _) = h2.drive(settings_rx).wait().unwrap(); let (mut h2, _) = h2.drive(settings_rx).wait().unwrap();
let request = Request::get("https://example.com/a") let request = Request::get("https://example.com/a").body(()).unwrap();
.body(())
.unwrap();
tx.send(h2.send_request(request, true).unwrap()).unwrap(); tx.send(h2.send_request(request, true).unwrap()).unwrap();
let request = Request::get("https://example.com/b") let request = Request::get("https://example.com/b").body(()).unwrap();
.body(())
.unwrap();
tx.send(h2.send_request(request, true).unwrap()).unwrap(); tx.send(h2.send_request(request, true).unwrap()).unwrap();

View File

@@ -16,9 +16,7 @@ fn recv_push_works() {
.request("GET", "https://http2.akamai.com/") .request("GET", "https://http2.akamai.com/")
.eos(), .eos(),
) )
.send_frame( .send_frame(frames::push_promise(1, 2).request("GET", "https://http2.akamai.com/style.css"))
frames::push_promise(1, 2).request("GET", "https://http2.akamai.com/style.css"),
)
.send_frame(frames::headers(1).response(200).eos()) .send_frame(frames::headers(1).response(200).eos())
.send_frame(frames::headers(2).response(200).eos()); .send_frame(frames::headers(2).response(200).eos());
@@ -55,9 +53,7 @@ fn recv_push_when_push_disabled_is_conn_error() {
.request("GET", "https://http2.akamai.com/") .request("GET", "https://http2.akamai.com/")
.eos(), .eos(),
) )
.send_frame( .send_frame(frames::push_promise(1, 3).request("GET", "https://http2.akamai.com/style.css"))
frames::push_promise(1, 3).request("GET", "https://http2.akamai.com/style.css"),
)
.send_frame(frames::headers(1).response(200).eos()) .send_frame(frames::headers(1).response(200).eos())
.recv_frame(frames::go_away(0).protocol_error()); .recv_frame(frames::go_away(0).protocol_error());