From 3eb5a059ade249dae4468a8bb6eb5784e1dfdb10 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Thu, 20 Jul 2023 11:02:15 +0100 Subject: [PATCH] chore: address clippy warnings --- actix-http/src/encoding/mod.rs | 2 +- actix-http/src/ws/mask.rs | 2 +- actix-http/tests/test_server.rs | 8 ++--- actix-router/src/resource.rs | 7 +++- actix-web/src/http/header/accept.rs | 8 ++--- actix-web/src/http/header/accept_charset.rs | 2 +- actix-web/src/http/header/accept_encoding.rs | 14 ++++---- actix-web/src/http/header/accept_language.rs | 12 +++---- actix-web/src/http/header/allow.rs | 6 ++-- actix-web/src/http/header/cache_control.rs | 12 +++---- actix-web/src/http/header/content_language.rs | 4 +-- actix-web/src/http/header/content_range.rs | 36 ++++++++----------- actix-web/src/http/header/content_type.rs | 4 +-- actix-web/src/http/header/date.rs | 2 +- actix-web/src/http/header/etag.rs | 30 ++++++++-------- actix-web/src/http/header/expires.rs | 2 +- actix-web/src/http/header/if_match.rs | 6 ++-- .../src/http/header/if_modified_since.rs | 2 +- actix-web/src/http/header/if_none_match.rs | 10 +++--- actix-web/src/http/header/if_range.rs | 6 ++-- .../src/http/header/if_unmodified_since.rs | 2 +- actix-web/src/http/header/last_modified.rs | 2 +- 22 files changed, 87 insertions(+), 92 deletions(-) diff --git a/actix-http/src/encoding/mod.rs b/actix-http/src/encoding/mod.rs index 7823f3979..6801b5fb0 100644 --- a/actix-http/src/encoding/mod.rs +++ b/actix-http/src/encoding/mod.rs @@ -12,7 +12,7 @@ pub use self::{decoder::Decoder, encoder::Encoder}; /// Special-purpose writer for streaming (de-)compression. /// /// Pre-allocates 8KiB of capacity. -pub(self) struct Writer { +struct Writer { buf: BytesMut, } diff --git a/actix-http/src/ws/mask.rs b/actix-http/src/ws/mask.rs index be72e5631..115a8cf9b 100644 --- a/actix-http/src/ws/mask.rs +++ b/actix-http/src/ws/mask.rs @@ -50,7 +50,7 @@ mod tests { #[test] fn test_apply_mask() { let mask = [0x6d, 0xb6, 0xb2, 0x80]; - let unmasked = vec![ + let unmasked = [ 0xf3, 0x00, 0x01, 0x02, 0x03, 0x80, 0x81, 0x82, 0xff, 0xfe, 0x00, 0x17, 0x74, 0xf9, 0x12, 0x03, ]; diff --git a/actix-http/tests/test_server.rs b/actix-http/tests/test_server.rs index cfb4d17b8..f55b1b36c 100644 --- a/actix-http/tests/test_server.rs +++ b/actix-http/tests/test_server.rs @@ -1,5 +1,3 @@ -#![allow(clippy::uninlined_format_args)] - use std::{ convert::Infallible, io::{Read, Write}, @@ -139,7 +137,7 @@ async fn expect_continue_h1() { #[actix_rt::test] async fn chunked_payload() { - let chunk_sizes = vec![32768, 32, 32768]; + let chunk_sizes = [32768, 32, 32768]; let total_size: usize = chunk_sizes.iter().sum(); let mut srv = test_server(|| { @@ -402,7 +400,7 @@ async fn content_length() { let mut srv = test_server(|| { HttpService::build() .h1(|req: Request| { - let indx: usize = req.uri().path()[1..].parse().unwrap(); + let idx: usize = req.uri().path()[1..].parse().unwrap(); let statuses = [ StatusCode::NO_CONTENT, StatusCode::CONTINUE, @@ -411,7 +409,7 @@ async fn content_length() { StatusCode::OK, StatusCode::NOT_FOUND, ]; - ok::<_, Infallible>(Response::new(statuses[indx])) + ok::<_, Infallible>(Response::new(statuses[idx])) }) .tcp() }) diff --git a/actix-router/src/resource.rs b/actix-router/src/resource.rs index b8aa6c224..a3e89a1fe 100644 --- a/actix-router/src/resource.rs +++ b/actix-router/src/resource.rs @@ -1529,7 +1529,12 @@ mod tests { assert!(!resource.resource_path_from_iter(&mut s, &mut ["item"].iter())); let mut s = String::new(); - assert!(resource.resource_path_from_iter(&mut s, &mut vec!["item", "item2"].iter())); + + assert!(resource.resource_path_from_iter( + &mut s, + #[allow(clippy::useless_vec)] + &mut vec!["item", "item2"].iter() + )); assert_eq!(s, "/user/item/item2/"); } diff --git a/actix-web/src/http/header/accept.rs b/actix-web/src/http/header/accept.rs index 1be136b19..99c95175f 100644 --- a/actix-web/src/http/header/accept.rs +++ b/actix-web/src/http/header/accept.rs @@ -78,7 +78,7 @@ common_header! { // Tests from the RFC crate::http::header::common_header_test!( test1, - vec![b"audio/*; q=0.2, audio/basic"], + [b"audio/*; q=0.2, audio/basic"], Some(Accept(vec![ QualityItem::new("audio/*".parse().unwrap(), q(0.2)), QualityItem::max("audio/basic".parse().unwrap()), @@ -86,7 +86,7 @@ common_header! { crate::http::header::common_header_test!( test2, - vec![b"text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c"], + [b"text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c"], Some(Accept(vec![ QualityItem::new(mime::TEXT_PLAIN, q(0.5)), QualityItem::max(mime::TEXT_HTML), @@ -99,13 +99,13 @@ common_header! { // Custom tests crate::http::header::common_header_test!( test3, - vec![b"text/plain; charset=utf-8"], + [b"text/plain; charset=utf-8"], Some(Accept(vec![ QualityItem::max(mime::TEXT_PLAIN_UTF_8), ]))); crate::http::header::common_header_test!( test4, - vec![b"text/plain; charset=utf-8; q=0.5"], + [b"text/plain; charset=utf-8; q=0.5"], Some(Accept(vec![ QualityItem::new(mime::TEXT_PLAIN_UTF_8, q(0.5)), ]))); diff --git a/actix-web/src/http/header/accept_charset.rs b/actix-web/src/http/header/accept_charset.rs index c7f7e1a68..43a7861fe 100644 --- a/actix-web/src/http/header/accept_charset.rs +++ b/actix-web/src/http/header/accept_charset.rs @@ -57,6 +57,6 @@ common_header! { test_parse_and_format { // Test case from RFC - common_header_test!(test1, vec![b"iso-8859-5, unicode-1-1;q=0.8"]); + common_header_test!(test1, [b"iso-8859-5, unicode-1-1;q=0.8"]); } } diff --git a/actix-web/src/http/header/accept_encoding.rs b/actix-web/src/http/header/accept_encoding.rs index 715126a03..cc80e7bb0 100644 --- a/actix-web/src/http/header/accept_encoding.rs +++ b/actix-web/src/http/header/accept_encoding.rs @@ -50,31 +50,31 @@ common_header! { (AcceptEncoding, header::ACCEPT_ENCODING) => (QualityItem>)* test_parse_and_format { - common_header_test!(no_headers, vec![b""; 0], Some(AcceptEncoding(vec![]))); - common_header_test!(empty_header, vec![b""; 1], Some(AcceptEncoding(vec![]))); + common_header_test!(no_headers, [b""; 0], Some(AcceptEncoding(vec![]))); + common_header_test!(empty_header, [b""; 1], Some(AcceptEncoding(vec![]))); common_header_test!( order_of_appearance, - vec![b"br, gzip"], + [b"br, gzip"], Some(AcceptEncoding(vec![ QualityItem::max(Preference::Specific(Encoding::brotli())), QualityItem::max(Preference::Specific(Encoding::gzip())), ])) ); - common_header_test!(any, vec![b"*"], Some(AcceptEncoding(vec![ + common_header_test!(any, [b"*"], Some(AcceptEncoding(vec![ QualityItem::max(Preference::Any), ]))); // Note: Removed quality 1 from gzip - common_header_test!(implicit_quality, vec![b"gzip, identity; q=0.5, *;q=0"]); + common_header_test!(implicit_quality, [b"gzip, identity; q=0.5, *;q=0"]); // Note: Removed quality 1 from gzip - common_header_test!(implicit_quality_out_of_order, vec![b"compress;q=0.5, gzip"]); + common_header_test!(implicit_quality_out_of_order, [b"compress;q=0.5, gzip"]); common_header_test!( only_gzip_no_identity, - vec![b"gzip, *; q=0"], + [b"gzip, *; q=0"], Some(AcceptEncoding(vec![ QualityItem::max(Preference::Specific(Encoding::gzip())), QualityItem::zero(Preference::Any), diff --git a/actix-web/src/http/header/accept_language.rs b/actix-web/src/http/header/accept_language.rs index 9943e121f..b1d588f8d 100644 --- a/actix-web/src/http/header/accept_language.rs +++ b/actix-web/src/http/header/accept_language.rs @@ -58,19 +58,19 @@ common_header! { (AcceptLanguage, header::ACCEPT_LANGUAGE) => (QualityItem>)* test_parse_and_format { - common_header_test!(no_headers, vec![b""; 0], Some(AcceptLanguage(vec![]))); + common_header_test!(no_headers, [b""; 0], Some(AcceptLanguage(vec![]))); - common_header_test!(empty_header, vec![b""; 1], Some(AcceptLanguage(vec![]))); + common_header_test!(empty_header, [b""; 1], Some(AcceptLanguage(vec![]))); common_header_test!( example_from_rfc, - vec![b"da, en-gb;q=0.8, en;q=0.7"] + [b"da, en-gb;q=0.8, en;q=0.7"] ); common_header_test!( not_ordered_by_weight, - vec![b"en-US, en; q=0.5, fr"], + [b"en-US, en; q=0.5, fr"], Some(AcceptLanguage(vec![ QualityItem::max("en-US".parse().unwrap()), QualityItem::new("en".parse().unwrap(), q(0.5)), @@ -80,7 +80,7 @@ common_header! { common_header_test!( has_wildcard, - vec![b"fr-CH, fr; q=0.9, en; q=0.8, de; q=0.7, *; q=0.5"], + [b"fr-CH, fr; q=0.9, en; q=0.8, de; q=0.7, *; q=0.5"], Some(AcceptLanguage(vec![ QualityItem::max("fr-CH".parse().unwrap()), QualityItem::new("fr".parse().unwrap(), q(0.9)), @@ -137,7 +137,7 @@ impl AcceptLanguage { b.quality.cmp(&a.quality) }); - types.into_iter().map(|qitem| qitem.item).collect() + types.into_iter().map(|q_item| q_item.item).collect() } } diff --git a/actix-web/src/http/header/allow.rs b/actix-web/src/http/header/allow.rs index d0ef96486..1ae8f00dc 100644 --- a/actix-web/src/http/header/allow.rs +++ b/actix-web/src/http/header/allow.rs @@ -51,12 +51,12 @@ crate::http::header::common_header! { // From the RFC crate::http::header::common_header_test!( test1, - vec![b"GET, HEAD, PUT"], + [b"GET, HEAD, PUT"], Some(HeaderField(vec![Method::GET, Method::HEAD, Method::PUT]))); // Own tests crate::http::header::common_header_test!( test2, - vec![b"OPTIONS, GET, PUT, POST, DELETE, HEAD, TRACE, CONNECT, PATCH"], + [b"OPTIONS, GET, PUT, POST, DELETE, HEAD, TRACE, CONNECT, PATCH"], Some(HeaderField(vec![ Method::OPTIONS, Method::GET, @@ -69,7 +69,7 @@ crate::http::header::common_header! { Method::PATCH]))); crate::http::header::common_header_test!( test3, - vec![b""], + [b""], Some(HeaderField(Vec::::new()))); } } diff --git a/actix-web/src/http/header/cache_control.rs b/actix-web/src/http/header/cache_control.rs index 37629313e..77e22d1c3 100644 --- a/actix-web/src/http/header/cache_control.rs +++ b/actix-web/src/http/header/cache_control.rs @@ -47,13 +47,13 @@ common_header! { (CacheControl, header::CACHE_CONTROL) => (CacheDirective)+ test_parse_and_format { - common_header_test!(no_headers, vec![b""; 0], None); - common_header_test!(empty_header, vec![b""; 1], None); - common_header_test!(bad_syntax, vec![b"foo="], None); + common_header_test!(no_headers, [b""; 0], None); + common_header_test!(empty_header, [b""; 1], None); + common_header_test!(bad_syntax, [b"foo="], None); common_header_test!( multiple_headers, - vec![&b"no-cache"[..], &b"private"[..]], + [&b"no-cache"[..], &b"private"[..]], Some(CacheControl(vec![ CacheDirective::NoCache, CacheDirective::Private, @@ -62,7 +62,7 @@ common_header! { common_header_test!( argument, - vec![b"max-age=100, private"], + [b"max-age=100, private"], Some(CacheControl(vec![ CacheDirective::MaxAge(100), CacheDirective::Private, @@ -71,7 +71,7 @@ common_header! { common_header_test!( extension, - vec![b"foo, bar=baz"], + [b"foo, bar=baz"], Some(CacheControl(vec![ CacheDirective::Extension("foo".to_owned(), None), CacheDirective::Extension("bar".to_owned(), Some("baz".to_owned())), diff --git a/actix-web/src/http/header/content_language.rs b/actix-web/src/http/header/content_language.rs index ff317e1de..5b0797ef3 100644 --- a/actix-web/src/http/header/content_language.rs +++ b/actix-web/src/http/header/content_language.rs @@ -48,7 +48,7 @@ common_header! { (ContentLanguage, CONTENT_LANGUAGE) => (QualityItem)+ test_parse_and_format { - crate::http::header::common_header_test!(test1, vec![b"da"]); - crate::http::header::common_header_test!(test2, vec![b"mi, en"]); + crate::http::header::common_header_test!(test1, [b"da"]); + crate::http::header::common_header_test!(test2, [b"mi, en"]); } } diff --git a/actix-web/src/http/header/content_range.rs b/actix-web/src/http/header/content_range.rs index 8befffd95..884926195 100644 --- a/actix-web/src/http/header/content_range.rs +++ b/actix-web/src/http/header/content_range.rs @@ -13,59 +13,59 @@ crate::http::header::common_header! { test_parse_and_format { crate::http::header::common_header_test!(test_bytes, - vec![b"bytes 0-499/500"], + [b"bytes 0-499/500"], Some(ContentRange(ContentRangeSpec::Bytes { range: Some((0, 499)), instance_length: Some(500) }))); crate::http::header::common_header_test!(test_bytes_unknown_len, - vec![b"bytes 0-499/*"], + [b"bytes 0-499/*"], Some(ContentRange(ContentRangeSpec::Bytes { range: Some((0, 499)), instance_length: None }))); crate::http::header::common_header_test!(test_bytes_unknown_range, - vec![b"bytes */500"], + [b"bytes */500"], Some(ContentRange(ContentRangeSpec::Bytes { range: None, instance_length: Some(500) }))); crate::http::header::common_header_test!(test_unregistered, - vec![b"seconds 1-2"], + [b"seconds 1-2"], Some(ContentRange(ContentRangeSpec::Unregistered { unit: "seconds".to_owned(), resp: "1-2".to_owned() }))); crate::http::header::common_header_test!(test_no_len, - vec![b"bytes 0-499"], + [b"bytes 0-499"], None::); crate::http::header::common_header_test!(test_only_unit, - vec![b"bytes"], + [b"bytes"], None::); crate::http::header::common_header_test!(test_end_less_than_start, - vec![b"bytes 499-0/500"], + [b"bytes 499-0/500"], None::); crate::http::header::common_header_test!(test_blank, - vec![b""], + [b""], None::); crate::http::header::common_header_test!(test_bytes_many_spaces, - vec![b"bytes 1-2/500 3"], + [b"bytes 1-2/500 3"], None::); crate::http::header::common_header_test!(test_bytes_many_slashes, - vec![b"bytes 1-2/500/600"], + [b"bytes 1-2/500/600"], None::); crate::http::header::common_header_test!(test_bytes_many_dashes, - vec![b"bytes 1-2-3/500"], + [b"bytes 1-2-3/500"], None::); } @@ -113,21 +113,13 @@ pub enum ContentRangeSpec { }, } -fn split_in_two(s: &str, separator: char) -> Option<(&str, &str)> { - let mut iter = s.splitn(2, separator); - match (iter.next(), iter.next()) { - (Some(a), Some(b)) => Some((a, b)), - _ => None, - } -} - impl FromStr for ContentRangeSpec { type Err = ParseError; fn from_str(s: &str) -> Result { - let res = match split_in_two(s, ' ') { + let res = match s.split_once(' ') { Some(("bytes", resp)) => { - let (range, instance_length) = split_in_two(resp, '/').ok_or(ParseError::Header)?; + let (range, instance_length) = resp.split_once('/').ok_or(ParseError::Header)?; let instance_length = if instance_length == "*" { None @@ -139,7 +131,7 @@ impl FromStr for ContentRangeSpec { None } else { let (first_byte, last_byte) = - split_in_two(range, '-').ok_or(ParseError::Header)?; + range.split_once('-').ok_or(ParseError::Header)?; let first_byte = first_byte.parse().map_err(|_| ParseError::Header)?; let last_byte = last_byte.parse().map_err(|_| ParseError::Header)?; if last_byte < first_byte { diff --git a/actix-web/src/http/header/content_type.rs b/actix-web/src/http/header/content_type.rs index bf86afffa..c43ef8a2f 100644 --- a/actix-web/src/http/header/content_type.rs +++ b/actix-web/src/http/header/content_type.rs @@ -45,11 +45,11 @@ crate::http::header::common_header! { test_parse_and_format { crate::http::header::common_header_test!( test_text_html, - vec![b"text/html"], + [b"text/html"], Some(HeaderField(mime::TEXT_HTML))); crate::http::header::common_header_test!( test_image_star, - vec![b"image/*"], + [b"image/*"], Some(HeaderField(mime::IMAGE_STAR))); } diff --git a/actix-web/src/http/header/date.rs b/actix-web/src/http/header/date.rs index a8ac65660..ac30424f0 100644 --- a/actix-web/src/http/header/date.rs +++ b/actix-web/src/http/header/date.rs @@ -32,7 +32,7 @@ crate::http::header::common_header! { (Date, DATE) => [HttpDate] test_parse_and_format { - crate::http::header::common_header_test!(test1, vec![b"Tue, 15 Nov 1994 08:12:31 GMT"]); + crate::http::header::common_header_test!(test1, [b"Tue, 15 Nov 1994 08:12:31 GMT"]); } } diff --git a/actix-web/src/http/header/etag.rs b/actix-web/src/http/header/etag.rs index 78f5447b3..b82208288 100644 --- a/actix-web/src/http/header/etag.rs +++ b/actix-web/src/http/header/etag.rs @@ -49,50 +49,50 @@ crate::http::header::common_header! { test_parse_and_format { // From the RFC crate::http::header::common_header_test!(test1, - vec![b"\"xyzzy\""], + [b"\"xyzzy\""], Some(ETag(EntityTag::new_strong("xyzzy".to_owned())))); crate::http::header::common_header_test!(test2, - vec![b"W/\"xyzzy\""], + [b"W/\"xyzzy\""], Some(ETag(EntityTag::new_weak("xyzzy".to_owned())))); crate::http::header::common_header_test!(test3, - vec![b"\"\""], + [b"\"\""], Some(ETag(EntityTag::new_strong("".to_owned())))); // Own tests crate::http::header::common_header_test!(test4, - vec![b"\"foobar\""], + [b"\"foobar\""], Some(ETag(EntityTag::new_strong("foobar".to_owned())))); crate::http::header::common_header_test!(test5, - vec![b"\"\""], + [b"\"\""], Some(ETag(EntityTag::new_strong("".to_owned())))); crate::http::header::common_header_test!(test6, - vec![b"W/\"weak-etag\""], + [b"W/\"weak-etag\""], Some(ETag(EntityTag::new_weak("weak-etag".to_owned())))); crate::http::header::common_header_test!(test7, - vec![b"W/\"\x65\x62\""], + [b"W/\"\x65\x62\""], Some(ETag(EntityTag::new_weak("\u{0065}\u{0062}".to_owned())))); crate::http::header::common_header_test!(test8, - vec![b"W/\"\""], + [b"W/\"\""], Some(ETag(EntityTag::new_weak("".to_owned())))); crate::http::header::common_header_test!(test9, - vec![b"no-dquotes"], + [b"no-dquotes"], None::); crate::http::header::common_header_test!(test10, - vec![b"w/\"the-first-w-is-case-sensitive\""], + [b"w/\"the-first-w-is-case-sensitive\""], None::); crate::http::header::common_header_test!(test11, - vec![b""], + [b""], None::); crate::http::header::common_header_test!(test12, - vec![b"\"unmatched-dquotes1"], + [b"\"unmatched-dquotes1"], None::); crate::http::header::common_header_test!(test13, - vec![b"unmatched-dquotes2\""], + [b"unmatched-dquotes2\""], None::); crate::http::header::common_header_test!(test14, - vec![b"matched-\"dquotes\""], + [b"matched-\"dquotes\""], None::); crate::http::header::common_header_test!(test15, - vec![b"\""], + [b"\""], None::); } } diff --git a/actix-web/src/http/header/expires.rs b/actix-web/src/http/header/expires.rs index 55fe5acc5..b677ab527 100644 --- a/actix-web/src/http/header/expires.rs +++ b/actix-web/src/http/header/expires.rs @@ -36,6 +36,6 @@ crate::http::header::common_header! { test_parse_and_format { // Test case from RFC - crate::http::header::common_header_test!(test1, vec![b"Thu, 01 Dec 1994 16:00:00 GMT"]); + crate::http::header::common_header_test!(test1, [b"Thu, 01 Dec 1994 16:00:00 GMT"]); } } diff --git a/actix-web/src/http/header/if_match.rs b/actix-web/src/http/header/if_match.rs index e299d30fe..e0b46a6c3 100644 --- a/actix-web/src/http/header/if_match.rs +++ b/actix-web/src/http/header/if_match.rs @@ -52,17 +52,17 @@ common_header! { test_parse_and_format { crate::http::header::common_header_test!( test1, - vec![b"\"xyzzy\""], + [b"\"xyzzy\""], Some(HeaderField::Items( vec![EntityTag::new_strong("xyzzy".to_owned())]))); crate::http::header::common_header_test!( test2, - vec![b"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\""], + [b"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\""], Some(HeaderField::Items( vec![EntityTag::new_strong("xyzzy".to_owned()), EntityTag::new_strong("r2d2xxxx".to_owned()), EntityTag::new_strong("c3piozzzz".to_owned())]))); - crate::http::header::common_header_test!(test3, vec![b"*"], Some(IfMatch::Any)); + crate::http::header::common_header_test!(test3, [b"*"], Some(IfMatch::Any)); } } diff --git a/actix-web/src/http/header/if_modified_since.rs b/actix-web/src/http/header/if_modified_since.rs index 897210944..8547ff490 100644 --- a/actix-web/src/http/header/if_modified_since.rs +++ b/actix-web/src/http/header/if_modified_since.rs @@ -35,6 +35,6 @@ crate::http::header::common_header! { test_parse_and_format { // Test case from RFC - crate::http::header::common_header_test!(test1, vec![b"Sat, 29 Oct 1994 19:43:31 GMT"]); + crate::http::header::common_header_test!(test1, [b"Sat, 29 Oct 1994 19:43:31 GMT"]); } } diff --git a/actix-web/src/http/header/if_none_match.rs b/actix-web/src/http/header/if_none_match.rs index 86d7da9b2..1a424df96 100644 --- a/actix-web/src/http/header/if_none_match.rs +++ b/actix-web/src/http/header/if_none_match.rs @@ -52,11 +52,11 @@ crate::http::header::common_header! { (IfNoneMatch, IF_NONE_MATCH) => {Any / (EntityTag)+} test_parse_and_format { - crate::http::header::common_header_test!(test1, vec![b"\"xyzzy\""]); - crate::http::header::common_header_test!(test2, vec![b"W/\"xyzzy\""]); - crate::http::header::common_header_test!(test3, vec![b"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\""]); - crate::http::header::common_header_test!(test4, vec![b"W/\"xyzzy\", W/\"r2d2xxxx\", W/\"c3piozzzz\""]); - crate::http::header::common_header_test!(test5, vec![b"*"]); + crate::http::header::common_header_test!(test1, [b"\"xyzzy\""]); + crate::http::header::common_header_test!(test2, [b"W/\"xyzzy\""]); + crate::http::header::common_header_test!(test3, [b"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\""]); + crate::http::header::common_header_test!(test4, [b"W/\"xyzzy\", W/\"r2d2xxxx\", W/\"c3piozzzz\""]); + crate::http::header::common_header_test!(test5, [b"*"]); } } diff --git a/actix-web/src/http/header/if_range.rs b/actix-web/src/http/header/if_range.rs index d7375c4c5..3e8727ab0 100644 --- a/actix-web/src/http/header/if_range.rs +++ b/actix-web/src/http/header/if_range.rs @@ -111,7 +111,7 @@ mod test_parse_and_format { use super::IfRange as HeaderField; use crate::http::header::*; - crate::http::header::common_header_test!(test1, vec![b"Sat, 29 Oct 1994 19:43:31 GMT"]); - crate::http::header::common_header_test!(test2, vec![b"\"abc\""]); - crate::http::header::common_header_test!(test3, vec![b"this-is-invalid"], None::); + crate::http::header::common_header_test!(test1, [b"Sat, 29 Oct 1994 19:43:31 GMT"]); + crate::http::header::common_header_test!(test2, [b"\"abc\""]); + crate::http::header::common_header_test!(test3, [b"this-is-invalid"], None::); } diff --git a/actix-web/src/http/header/if_unmodified_since.rs b/actix-web/src/http/header/if_unmodified_since.rs index 2ee3160b4..afa4eb8e5 100644 --- a/actix-web/src/http/header/if_unmodified_since.rs +++ b/actix-web/src/http/header/if_unmodified_since.rs @@ -35,6 +35,6 @@ crate::http::header::common_header! { test_parse_and_format { // Test case from RFC - crate::http::header::common_header_test!(test1, vec![b"Sat, 29 Oct 1994 19:43:31 GMT"]); + crate::http::header::common_header_test!(test1, [b"Sat, 29 Oct 1994 19:43:31 GMT"]); } } diff --git a/actix-web/src/http/header/last_modified.rs b/actix-web/src/http/header/last_modified.rs index 59e649bea..724a38bbc 100644 --- a/actix-web/src/http/header/last_modified.rs +++ b/actix-web/src/http/header/last_modified.rs @@ -34,6 +34,6 @@ crate::http::header::common_header! { test_parse_and_format { // Test case from RFC - crate::http::header::common_header_test!(test1, vec![b"Sat, 29 Oct 1994 19:43:31 GMT"]); + crate::http::header::common_header_test!(test1, [b"Sat, 29 Oct 1994 19:43:31 GMT"]); } }