diff --git a/Cargo.toml b/Cargo.toml index 20f47ecd4..366ba6e25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "url" -version = "0.2.20" +version = "0.2.21" authors = [ "Simon Sapin " ] description = "URL parser for Rust" diff --git a/src/encoding.rs b/src/encoding.rs index f8ee74d8a..876742192 100644 --- a/src/encoding.rs +++ b/src/encoding.rs @@ -59,7 +59,7 @@ impl EncodingOverride { } } - pub fn encode<'a>(&self, input: &'a str) -> Cow<'a, Vec, [u8]> { + pub fn encode<'a>(&self, input: &'a str) -> Cow<'a, [u8]> { match self.encoding { Some(encoding) => Cow::Owned( encoding.encode(input, EncoderTrap::NcrEscape).unwrap()), @@ -91,7 +91,7 @@ impl EncodingOverride { String::from_utf8_lossy(input).into_owned() } - pub fn encode<'a>(&self, input: &'a str) -> Cow<'a, Vec, [u8]> { + pub fn encode<'a>(&self, input: &'a str) -> Cow<'a, [u8]> { Cow::Borrowed(input.as_bytes()) } } diff --git a/src/form_urlencoded.rs b/src/form_urlencoded.rs index 4f8bbb95f..4e5a69115 100644 --- a/src/form_urlencoded.rs +++ b/src/form_urlencoded.rs @@ -56,7 +56,7 @@ fn parse_internal(input: &[u8], mut encoding_override: EncodingOverride, mut use if !piece.is_empty() { let (name, value) = match piece.position_elem(&b'=') { Some(position) => (&piece[..position], &piece[position + 1..]), - None => (piece, &[][]) + None => (piece, &[][..]) }; #[inline] diff --git a/src/host.rs b/src/host.rs index 3fd26bf67..60ecc38d3 100644 --- a/src/host.rs +++ b/src/host.rs @@ -60,7 +60,7 @@ impl Host { Err(ParseError::NonAsciiDomainsNotSupportedYet) } else if domain.find(&[ '\0', '\t', '\n', '\r', ' ', '#', '%', '/', ':', '?', '@', '[', '\\', ']' - ][]).is_some() { + ][..]).is_some() { Err(ParseError::InvalidDomainCharacter) } else { Ok(Host::Domain(domain.to_string().into_ascii_lowercase())) diff --git a/src/lib.rs b/src/lib.rs index 5dcd11006..da39f628b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -119,7 +119,7 @@ assert!(css_url.serialize() == "http://servo.github.io/rust-url/main.css".to_str */ -#![feature(core, std_misc, collections, path, hash)] +#![feature(core, std_misc, collections, old_path)] extern crate "rustc-serialize" as rustc_serialize; @@ -242,8 +242,8 @@ pub struct RelativeSchemeData { pub path: Vec, } -impl hash::Hash for Url { - fn hash(&self, state: &mut H) { +impl hash::Hash for Url { + fn hash(&self, state: &mut H) { self.serialize().hash(state) } } @@ -983,7 +983,7 @@ impl FromUrlPath for path::windows::Path { if path.is_empty() { return Err(()) } - let prefix = &path[0][]; + let prefix = &*path[0]; if prefix.len() != 2 || !parser::starts_with_ascii_alpha(prefix) || prefix.as_bytes()[1] != b':' { return Err(()) diff --git a/src/parser.rs b/src/parser.rs index e948392ff..2f494a749 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -93,7 +93,7 @@ pub enum Context { pub fn parse_url(input: &str, parser: &UrlParser) -> ParseResult { - let input = input.trim_matches(&[' ', '\t', '\n', '\r', '\x0C'][]); + let input = input.trim_matches(&[' ', '\t', '\n', '\r', '\x0C'][..]); let (scheme, remaining) = match parse_scheme(input, Context::UrlParser) { Some((scheme, remaining)) => (scheme, remaining), // No-scheme state diff --git a/src/tests.rs b/src/tests.rs index 9c5087d92..78c7903bf 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -209,7 +209,7 @@ fn file_paths() { let mut url = Url::from_file_path(&path::posix::Path::new("/foo/bar")).unwrap(); assert_eq!(url.host(), Some(&Host::Domain("".to_string()))); - assert_eq!(url.path(), Some(&["foo".to_string(), "bar".to_string()][])); + assert_eq!(url.path(), Some(&["foo".to_string(), "bar".to_string()][..])); assert!(url.to_file_path() == Ok(path::posix::Path::new("/foo/bar"))); url.path_mut().unwrap()[1] = "ba\0r".to_string(); @@ -225,7 +225,7 @@ fn file_paths() { let mut url = Url::from_file_path(&path::windows::Path::new(r"C:\foo\bar")).unwrap(); assert_eq!(url.host(), Some(&Host::Domain("".to_string()))); - assert_eq!(url.path(), Some(&["C:".to_string(), "foo".to_string(), "bar".to_string()][])); + assert_eq!(url.path(), Some(&["C:".to_string(), "foo".to_string(), "bar".to_string()][..])); assert!(url.to_file_path::() == Ok(path::windows::Path::new(r"C:\foo\bar"))); @@ -252,10 +252,10 @@ fn directory_paths() { let url = Url::from_directory_path(&path::posix::Path::new("/foo/bar")).unwrap(); assert_eq!(url.host(), Some(&Host::Domain("".to_string()))); - assert_eq!(url.path(), Some(&["foo".to_string(), "bar".to_string(), "".to_string()][])); + assert_eq!(url.path(), Some(&["foo".to_string(), "bar".to_string(), "".to_string()][..])); let url = Url::from_directory_path(&path::windows::Path::new(r"C:\foo\bar")).unwrap(); assert_eq!(url.host(), Some(&Host::Domain("".to_string()))); assert_eq!(url.path(), Some(&[ - "C:".to_string(), "foo".to_string(), "bar".to_string(), "".to_string()][])); + "C:".to_string(), "foo".to_string(), "bar".to_string(), "".to_string()][..])); }