diff --git a/.travis.yml b/.travis.yml index dacb3065..89206961 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ matrix: env: FEATURES="--features nightly" - rust: beta - rust: stable + - rust: 1.10.0 cache: apt: true diff --git a/Cargo.toml b/Cargo.toml index 71d70841..420b3a27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,6 @@ license = "MIT" authors = ["Sean McArthur "] keywords = ["http", "hyper", "hyperium"] categories = ["web-programming::http-client", "web-programming::http-server"] -build = "build.rs" include = [ "build.rs", @@ -41,9 +40,6 @@ num_cpus = "1.0" pretty_env_logger = "0.1" spmc = "0.2" -[build-dependencies] -rustc_version = "0.1" - [features] default = [] nightly = [] diff --git a/build.rs b/build.rs deleted file mode 100644 index e886b726..00000000 --- a/build.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern crate rustc_version as rustc; - -fn main() { - if rustc::version_matches(">= 1.9") { - println!("cargo:rustc-cfg=has_deprecated"); - } -} diff --git a/src/header/common/accept_language.rs b/src/header/common/accept_language.rs index aa31cf94..7ba3bb01 100644 --- a/src/header/common/accept_language.rs +++ b/src/header/common/accept_language.rs @@ -58,9 +58,9 @@ header! { test_header!( test2, vec![b"en-US, en; q=0.5, fr"], Some(AcceptLanguage(vec![ - qitem(langtag!(en;;;US)), - QualityItem::new(langtag!(en), Quality(500)), - qitem(langtag!(fr)), + qitem("en-US".parse().unwrap()), + QualityItem::new("en".parse().unwrap(), Quality(500)), + qitem("fr".parse().unwrap()), ]))); } } diff --git a/src/header/common/host.rs b/src/header/common/host.rs index 3f95d63f..94f8ed10 100644 --- a/src/header/common/host.rs +++ b/src/header/common/host.rs @@ -24,7 +24,9 @@ use header::parsing::from_one_raw_str; /// /// let mut headers = Headers::new(); /// headers.set( -/// Host::new("hyper.rs", 8080) +/// // In Rust 1.12+ +/// // Host::new("hyper.rs", 8080) +/// Host::new("hyper.rs", Some(8080)) /// ); /// ``` #[derive(Clone, PartialEq, Debug)] @@ -113,13 +115,13 @@ mod tests { let host = Header::parse_header(&vec![b"foo.com:8080".to_vec()].into()); - assert_eq!(host.ok(), Some(Host::new("foo.com", 8080))); + assert_eq!(host.ok(), Some(Host::new("foo.com", Some(8080)))); let host = Header::parse_header(&vec![b"foo.com".to_vec()].into()); assert_eq!(host.ok(), Some(Host::new("foo.com", None))); let host = Header::parse_header(&vec![b"[::1]:8080".to_vec()].into()); - assert_eq!(host.ok(), Some(Host::new("[::1]", 8080))); + assert_eq!(host.ok(), Some(Host::new("[::1]", Some(8080)))); let host = Header::parse_header(&vec![b"[::1]".to_vec()].into()); assert_eq!(host.ok(), Some(Host::new("[::1]", None))); diff --git a/src/header/common/link.rs b/src/header/common/link.rs index d6cafa60..f13ac3ae 100644 --- a/src/header/common/link.rs +++ b/src/header/common/link.rs @@ -982,7 +982,7 @@ mod tests { .push_rel(RelationType::Previous) .set_anchor("../anchor/example/") .push_rev(RelationType::Next) - .push_href_lang(langtag!(de)) + .push_href_lang("de".parse().unwrap()) .push_media_desc(MediaDesc::Screen) .set_title("previous chapter") .set_title_star("title* unparsed") @@ -1042,7 +1042,7 @@ mod tests { .push_rel(RelationType::Previous) .set_anchor("/anchor/example/") .push_rev(RelationType::Next) - .push_href_lang(langtag!(de)) + .push_href_lang("de".parse().unwrap()) .push_media_desc(MediaDesc::Screen) .set_title("previous chapter") .set_title_star("title* unparsed") diff --git a/src/header/parsing.rs b/src/header/parsing.rs index 84efe44a..8706b32d 100644 --- a/src/header/parsing.rs +++ b/src/header/parsing.rs @@ -177,10 +177,11 @@ mod percent_encoding_http { mod tests { use header::shared::Charset; use super::{ExtendedValue, parse_extended_value}; + use language_tags::LanguageTag; #[test] fn test_parse_extended_value_with_encoding_and_language_tag() { - let expected_language_tag = langtag!(en); + let expected_language_tag = "en".parse::().unwrap(); // RFC 5987, Section 3.2.2 // Extended notation, using the Unicode character U+00A3 (POUND SIGN) let result = parse_extended_value("iso-8859-1'en'%A3%20rates"); diff --git a/src/http/h1/decode.rs b/src/http/h1/decode.rs index e22b7cb1..293b2102 100644 --- a/src/http/h1/decode.rs +++ b/src/http/h1/decode.rs @@ -458,7 +458,7 @@ mod tests { let content_len = content.len(); for block_at in 0..content_len { let actual = read_async(decoder.clone(), content.as_bytes(), block_at); - assert_eq!(expected, &actual, "Failed async. Blocking at {}", block_at); + assert_eq!(expected, &actual) //, "Failed async. Blocking at {}", block_at); } } diff --git a/src/http/mod.rs b/src/http/mod.rs index c1a40119..9b9839e1 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -131,7 +131,7 @@ pub trait Http1Transaction { fn should_set_length(head: &MessageHead) -> bool; } -type ParseResult = ::Result, usize)>>; +pub type ParseResult = ::Result, usize)>>; struct DebugTruncate<'a>(&'a [u8]); diff --git a/src/lib.rs b/src/lib.rs index 5ffd1560..2db6f368 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,7 @@ extern crate bytes; #[macro_use] extern crate futures; extern crate futures_cpupool; extern crate httparse; -#[cfg_attr(test, macro_use)] extern crate language_tags; +extern crate language_tags; #[macro_use] extern crate log; #[macro_use] pub extern crate mime; extern crate base64; @@ -56,13 +56,6 @@ macro_rules! unimplemented { }); } -macro_rules! deprecated { - (#[$note:meta] $i:item) => ( - #[cfg_attr(has_deprecated, $note)] - $i - ); -} - #[cfg(test)] mod mock; pub mod client; diff --git a/src/uri.rs b/src/uri.rs index c1f72736..1e04b2a2 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -553,6 +553,6 @@ fn test_uri_to_origin_form() { for case in cases { let uri = Uri::from_str(case.0).unwrap(); - assert_eq!(origin_form(&uri), case.1, "{:?}", case); + assert_eq!(origin_form(&uri), case.1); //, "{:?}", case); } } diff --git a/tests/client.rs b/tests/client.rs index 30c9e463..e93426c8 100644 --- a/tests/client.rs +++ b/tests/client.rs @@ -78,7 +78,7 @@ macro_rules! test { while n < buf.len() && n < expected.len() { n += inc.read(&mut buf[n..]).unwrap(); } - assert_eq!(s(&buf[..n]), expected, "expected is invalid"); + assert_eq!(s(&buf[..n]), expected); inc.write_all($server_reply.as_ref()).unwrap(); let _ = tx.send(()); @@ -89,9 +89,9 @@ macro_rules! test { let work = res.join(rx).map(|r| r.0); let res = core.run(work).unwrap(); - assert_eq!(res.status(), StatusCode::$client_status, "status is invalid"); + assert_eq!(res.status(), StatusCode::$client_status); $( - assert_eq!(res.headers().get(), Some(&$response_headers), "headers are invalid"); + assert_eq!(res.headers().get(), Some(&$response_headers)); )* } );