From 3d622d6012085c53ef5c536e9b249393b1c62380 Mon Sep 17 00:00:00 2001 From: kevinpoitra Date: Fri, 24 Jan 2020 01:16:27 -0600 Subject: [PATCH] Fix type confusion when using `time::parse` followed by `using_offset` --- actix-http/src/cookie/mod.rs | 4 ++-- actix-http/src/cookie/parse.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actix-http/src/cookie/mod.rs b/actix-http/src/cookie/mod.rs index 8c991f53c..09120e19f 100644 --- a/actix-http/src/cookie/mod.rs +++ b/actix-http/src/cookie/mod.rs @@ -990,7 +990,7 @@ impl<'a, 'b> PartialEq> for Cookie<'a> { #[cfg(test)] mod tests { use super::{Cookie, SameSite}; - use time::offset; + use time::{offset, PrimitiveDateTime}; #[test] fn format() { @@ -1015,7 +1015,7 @@ mod tests { assert_eq!(&cookie.to_string(), "foo=bar; Domain=www.rust-lang.org"); let time_str = "Wed, 21 Oct 2015 07:28:00 GMT"; - let expires = time::parse(time_str, "%a, %d %b %Y %H:%M:%S").unwrap().using_offset(offset!(UTC)); + let expires = PrimitiveDateTime::parse(time_str, "%a, %d %b %Y %H:%M:%S").unwrap().using_offset(offset!(UTC)); let cookie = Cookie::build("foo", "bar").expires(expires).finish(); assert_eq!( &cookie.to_string(), diff --git a/actix-http/src/cookie/parse.rs b/actix-http/src/cookie/parse.rs index f5ef4e966..28eb4f8b6 100644 --- a/actix-http/src/cookie/parse.rs +++ b/actix-http/src/cookie/parse.rs @@ -216,7 +216,7 @@ where #[cfg(test)] mod tests { use super::{Cookie, SameSite}; - use time::{offset, Duration}; + use time::{offset, Duration, PrimitiveDateTime}; macro_rules! assert_eq_parse { ($string:expr, $expected:expr) => { @@ -376,7 +376,7 @@ mod tests { ); let time_str = "Wed, 21 Oct 2015 07:28:00 GMT"; - let expires = time::parse(time_str, "%a, %d %b %Y %H:%M:%S").unwrap().using_offset(offset!(UTC)); + let expires = PrimitiveDateTime::parse(time_str, "%a, %d %b %Y %H:%M:%S").unwrap().using_offset(offset!(UTC)); expected.set_expires(expires); assert_eq_parse!( " foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \ @@ -385,7 +385,7 @@ mod tests { ); unexpected.set_domain("foo.com"); - let bad_expires = time::parse(time_str, "%a, %d %b %Y %H:%S:%M").unwrap().using_offset(offset!(UTC)); + let bad_expires = PrimitiveDateTime::parse(time_str, "%a, %d %b %Y %H:%S:%M").unwrap().using_offset(offset!(UTC)); expected.set_expires(bad_expires); assert_ne_parse!( " foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \