Skip to content

Commit

Permalink
Upgrade to rustc 1.0.0-nightly (522d09dfe 2015-02-19) (built 2015-02-20)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Feb 20, 2015
1 parent 16923fb commit 6a20f9b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "url"
version = "0.2.20"
version = "0.2.21"
authors = [ "Simon Sapin <simon.sapin@exyr.org>" ]

description = "URL parser for Rust"
Expand Down
4 changes: 2 additions & 2 deletions src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl EncodingOverride {
}
}

pub fn encode<'a>(&self, input: &'a str) -> Cow<'a, Vec<u8>, [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()),
Expand Down Expand Up @@ -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>, [u8]> {
pub fn encode<'a>(&self, input: &'a str) -> Cow<'a, [u8]> {
Cow::Borrowed(input.as_bytes())
}
}
2 changes: 1 addition & 1 deletion src/form_urlencoded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -242,8 +242,8 @@ pub struct RelativeSchemeData {
pub path: Vec<String>,
}

impl<H: hash::Hasher + hash::Writer> hash::Hash<H> for Url {
fn hash(&self, state: &mut H) {
impl hash::Hash for Url {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.serialize().hash(state)
}
}
Expand Down Expand Up @@ -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(())
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub enum Context {


pub fn parse_url(input: &str, parser: &UrlParser) -> ParseResult<Url> {
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
Expand Down
8 changes: 4 additions & 4 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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::<path::windows::Path>()
== Ok(path::windows::Path::new(r"C:\foo\bar")));

Expand All @@ -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()][..]));
}

0 comments on commit 6a20f9b

Please sign in to comment.