mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-31 08:57:00 +02:00
clippy warnings
This commit is contained in:
@@ -64,7 +64,11 @@ 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())) }
|
||||
unsafe {
|
||||
Ok(HeaderValue::from_shared_unchecked(
|
||||
wrt.get_mut().take().freeze(),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,12 +104,24 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_date() {
|
||||
assert_eq!("Sun, 07 Nov 1994 08:48:37 GMT".parse::<HttpDate>().unwrap(), NOV_07);
|
||||
assert_eq!(
|
||||
"Sunday, 07-Nov-94 08:48:37 GMT".parse::<HttpDate>().unwrap(),
|
||||
"Sun, 07 Nov 1994 08:48:37 GMT"
|
||||
.parse::<HttpDate>()
|
||||
.unwrap(),
|
||||
NOV_07
|
||||
);
|
||||
assert_eq!(
|
||||
"Sunday, 07-Nov-94 08:48:37 GMT"
|
||||
.parse::<HttpDate>()
|
||||
.unwrap(),
|
||||
NOV_07
|
||||
);
|
||||
assert_eq!(
|
||||
"Sun Nov 7 08:48:37 1994"
|
||||
.parse::<HttpDate>()
|
||||
.unwrap(),
|
||||
NOV_07
|
||||
);
|
||||
assert_eq!("Sun Nov 7 08:48:37 1994".parse::<HttpDate>().unwrap(), NOV_07);
|
||||
assert!("this-is-no-date".parse::<HttpDate>().is_err());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user