1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 18:09:22 +02:00

various cleanups and comments

This commit is contained in:
Nikolay Kim
2018-06-20 01:27:41 +06:00
parent 311f0b23a9
commit 2f917f3700
10 changed files with 137 additions and 125 deletions

View File

@ -161,7 +161,7 @@ impl IntoHeaderValue for EntityTag {
fn try_into(self) -> Result<HeaderValue, Self::Error> {
let mut wrt = Writer::new();
write!(wrt, "{}", self).unwrap();
unsafe { Ok(HeaderValue::from_shared_unchecked(wrt.take())) }
HeaderValue::from_shared(wrt.take())
}
}

View File

@ -64,11 +64,7 @@ impl IntoHeaderValue for HttpDate {
fn try_into(self) -> Result<HeaderValue, Self::Error> {
let mut wrt = BytesMut::with_capacity(29).writer();
write!(wrt, "{}", self.0.rfc822()).unwrap();
unsafe {
Ok(HeaderValue::from_shared_unchecked(
wrt.get_mut().take().freeze(),
))
}
HeaderValue::from_shared(wrt.get_mut().take().freeze())
}
}