Rename Builder::head

This commit is contained in:
Alex Crichton
2017-07-26 15:55:20 -07:00
parent 7de27af221
commit c266c25c8f
3 changed files with 5 additions and 11 deletions
+1 -5
View File
@@ -32,11 +32,7 @@ enum ErrorKind {
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", error::Error::description(self))?;
match self.inner {
ErrorKind::Io(ref e) => write!(f, ": {}", e),
_ => Ok(())
}
error::Error::description(self).fmt(f)
}
}
+2 -3
View File
@@ -508,8 +508,7 @@ impl Builder {
self
}
/// "Consumes" this builder, returning the constructed `Head`.
fn head(&mut self) -> Result<Parts> {
fn take_parts(&mut self) -> Result<Parts> {
let ret = self.head.take().expect("cannot reuse request builder");
if let Some(e) = self.err.take() {
return Err(e)
@@ -544,7 +543,7 @@ impl Builder {
/// ```
pub fn body<T>(&mut self, body: T) -> Result<Request<T>> {
Ok(Request {
head: self.head()?,
head: self.take_parts()?,
body: body,
})
}
+2 -3
View File
@@ -450,8 +450,7 @@ impl Builder {
self
}
/// "Consumes" this builder, returning the constructed `Parts`.
fn head(&mut self) -> Result<Parts> {
fn take_parts(&mut self) -> Result<Parts> {
let ret = self.head.take().expect("cannot reuse response builder");
if let Some(e) = self.err.take() {
return Err(e)
@@ -486,7 +485,7 @@ impl Builder {
/// ```
pub fn body<T>(&mut self, body: T) -> Result<Response<T>> {
Ok(Response {
head: self.head()?,
head: self.take_parts()?,
body: body,
})
}