convert several unimplemented into proper asserts

This commit is contained in:
Sean McArthur
2017-10-05 17:09:51 -07:00
parent 38900df185
commit 9737d0c6a0

View File

@@ -263,9 +263,9 @@ where
) -> Result<(), RecvError> { ) -> Result<(), RecvError> {
let sz = frame.payload().len(); let sz = frame.payload().len();
if sz > MAX_WINDOW_SIZE as usize { // This should have been enforced at the codec::FramedRead layer, so
unimplemented!(); // this is just a sanity check.
} assert!(sz <= MAX_WINDOW_SIZE as usize);
let sz = sz as WindowSize; let sz = sz as WindowSize;
@@ -611,7 +611,7 @@ where
// TODO: This is a user error. `poll_trailers` was called before // TODO: This is a user error. `poll_trailers` was called before
// the entire set of data frames have been consumed. What should // the entire set of data frames have been consumed. What should
// we do? // we do?
unimplemented!(); panic!("poll_trailers called before data has been consumed");
}, },
None => self.schedule_recv(stream), None => self.schedule_recv(stream),
} }
@@ -654,7 +654,7 @@ where
// frame or the user violated the contract. // frame or the user violated the contract.
match stream.pending_recv.pop_front(&mut self.buffer) { match stream.pending_recv.pop_front(&mut self.buffer) {
Some(Event::Headers(response)) => Ok(response.into()), Some(Event::Headers(response)) => Ok(response.into()),
Some(_) => unimplemented!(), Some(_) => panic!("poll_response called after response returned"),
None => { None => {
stream.state.ensure_recv_open()?; stream.state.ensure_recv_open()?;