diff --git a/src/headers.rs b/src/headers.rs index 32131e02..52fcaba8 100644 --- a/src/headers.rs +++ b/src/headers.rs @@ -14,7 +14,7 @@ pub fn connection_close(value: &HeaderValue) -> bool { fn connection_has(value: &HeaderValue, needle: &str) -> bool { if let Ok(s) = value.to_str() { for val in s.split(',') { - if eq_ascii(val.trim(), needle) { + if val.trim().eq_ignore_ascii_case(needle) { return true; } } @@ -87,7 +87,7 @@ pub fn is_chunked_(value: &HeaderValue) -> bool { // chunked must always be the last encoding, according to spec if let Ok(s) = value.to_str() { if let Some(encoding) = s.rsplit(',').next() { - return eq_ascii(encoding.trim(), "chunked"); + return encoding.trim().eq_ignore_ascii_case("chunked"); } } @@ -112,14 +112,3 @@ pub fn add_chunked(mut entry: OccupiedEntry) { entry.insert(HeaderValue::from_static(CHUNKED)); } - -fn eq_ascii(left: &str, right: &str) -> bool { - // As of Rust 1.23, str gained this method inherently, and so the - // compiler says this trait is unused. - // - // TODO: Once our minimum Rust compiler version is >=1.23, this can be removed. - #[allow(unused, deprecated)] - use std::ascii::AsciiExt; - - left.eq_ignore_ascii_case(right) -}