refactor(lib): clean up unused dependencies
This commit is contained in:
		| @@ -21,7 +21,6 @@ include = [ | |||||||
| ] | ] | ||||||
|  |  | ||||||
| [dependencies] | [dependencies] | ||||||
| base64 = "0.9" |  | ||||||
| bytes = "0.4.4" | bytes = "0.4.4" | ||||||
| futures = "0.1.17" | futures = "0.1.17" | ||||||
| futures-cpupool = "0.1.6" | futures-cpupool = "0.1.6" | ||||||
| @@ -29,18 +28,13 @@ futures-timer = "0.1.0" | |||||||
| http = "0.1.5" | http = "0.1.5" | ||||||
| httparse = "1.0" | httparse = "1.0" | ||||||
| iovec = "0.1" | iovec = "0.1" | ||||||
| language-tags = "0.2" |  | ||||||
| log = "0.4" | log = "0.4" | ||||||
| mime = "0.3.2" |  | ||||||
| net2 = "0.2.32" | net2 = "0.2.32" | ||||||
| percent-encoding = "1.0" |  | ||||||
| relay = "0.1" |  | ||||||
| time = "0.1" | time = "0.1" | ||||||
| tokio = "0.1.3" | tokio = "0.1.3" | ||||||
| tokio-executor = "0.1.0" | tokio-executor = "0.1.0" | ||||||
| tokio-service = "0.1" | tokio-service = "0.1" | ||||||
| tokio-io = "0.1" | tokio-io = "0.1" | ||||||
| unicase = "2.0" |  | ||||||
|  |  | ||||||
| [dev-dependencies] | [dev-dependencies] | ||||||
| num_cpus = "1.0" | num_cpus = "1.0" | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ use bytes::BytesMut; | |||||||
| use http::HeaderMap; | use http::HeaderMap; | ||||||
| use http::header::{CONNECTION, CONTENT_LENGTH, EXPECT, TRANSFER_ENCODING}; | use http::header::{CONNECTION, CONTENT_LENGTH, EXPECT, TRANSFER_ENCODING}; | ||||||
| use http::header::{HeaderValue, OccupiedEntry, ValueIter}; | use http::header::{HeaderValue, OccupiedEntry, ValueIter}; | ||||||
| use unicase; |  | ||||||
|  |  | ||||||
| /// Maximum number of bytes needed to serialize a u64 into ASCII decimal. | /// Maximum number of bytes needed to serialize a u64 into ASCII decimal. | ||||||
| const MAX_DECIMAL_U64_BYTES: usize = 20; | const MAX_DECIMAL_U64_BYTES: usize = 20; | ||||||
| @@ -13,7 +12,7 @@ pub fn connection_keep_alive(headers: &HeaderMap) -> bool { | |||||||
|     for line in headers.get_all(CONNECTION) { |     for line in headers.get_all(CONNECTION) { | ||||||
|         if let Ok(s) = line.to_str() { |         if let Ok(s) = line.to_str() { | ||||||
|             for val in s.split(',') { |             for val in s.split(',') { | ||||||
|                 if unicase::eq_ascii(val.trim(), "keep-alive") { |                 if eq_ascii(val.trim(), "keep-alive") { | ||||||
|                     return true; |                     return true; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @@ -27,7 +26,7 @@ pub fn connection_close(headers: &HeaderMap) -> bool { | |||||||
|     for line in headers.get_all(CONNECTION) { |     for line in headers.get_all(CONNECTION) { | ||||||
|         if let Ok(s) = line.to_str() { |         if let Ok(s) = line.to_str() { | ||||||
|             for val in s.split(',') { |             for val in s.split(',') { | ||||||
|                 if unicase::eq_ascii(val.trim(), "close") { |                 if eq_ascii(val.trim(), "close") { | ||||||
|                     return true; |                     return true; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @@ -98,7 +97,7 @@ pub fn is_chunked(mut encodings: ValueIter<HeaderValue>) -> bool { | |||||||
|     if let Some(line) = encodings.next_back() { |     if let Some(line) = encodings.next_back() { | ||||||
|         if let Ok(s) = line.to_str() { |         if let Ok(s) = line.to_str() { | ||||||
|             if let Some(encoding) = s.rsplit(',').next() { |             if let Some(encoding) = s.rsplit(',').next() { | ||||||
|                 return unicase::eq_ascii(encoding.trim(), "chunked"); |                 return eq_ascii(encoding.trim(), "chunked"); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -125,6 +124,17 @@ pub fn add_chunked(mut entry: OccupiedEntry<HeaderValue>) { | |||||||
|     entry.insert(HeaderValue::from_static(CHUNKED)); |     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. | ||||||
|  |     // | ||||||
|  |     // Once our minimum Rust compiler version is >=1.23, this can be removed. | ||||||
|  |     #[allow(unused)] | ||||||
|  |     use std::ascii::AsciiExt; | ||||||
|  |  | ||||||
|  |     left.eq_ignore_ascii_case(right) | ||||||
|  | } | ||||||
|  |  | ||||||
| #[cfg(test)] | #[cfg(test)] | ||||||
| mod tests { | mod tests { | ||||||
|     #[test] |     #[test] | ||||||
|   | |||||||
| @@ -25,13 +25,11 @@ extern crate httparse; | |||||||
| extern crate iovec; | extern crate iovec; | ||||||
| #[macro_use] extern crate log; | #[macro_use] extern crate log; | ||||||
| extern crate net2; | extern crate net2; | ||||||
| extern crate relay; |  | ||||||
| extern crate time; | extern crate time; | ||||||
| extern crate tokio; | extern crate tokio; | ||||||
| extern crate tokio_executor; | extern crate tokio_executor; | ||||||
| #[macro_use] extern crate tokio_io; | #[macro_use] extern crate tokio_io; | ||||||
| extern crate tokio_service; | extern crate tokio_service; | ||||||
| extern crate unicase; |  | ||||||
|  |  | ||||||
| #[cfg(all(test, feature = "nightly"))] | #[cfg(all(test, feature = "nightly"))] | ||||||
| extern crate test; | extern crate test; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user