Эх сурвалжийг харах

Merge pull request #16 from dotdash/rustup

Fix building with current rust
Simon Sapin 12 жил өмнө
parent
commit
23fb9ec22c

+ 4 - 1
src/form_urlencoded.rs

@@ -52,7 +52,10 @@ pub fn parse_bytes(input: &[u8], encoding_override: Option<EncodingRef>,
         } else {
         } else {
             let (name, value) = match piece.position_elem(&b'=') {
             let (name, value) = match piece.position_elem(&b'=') {
                 Some(position) => (piece.slice_to(position), piece.slice_from(position + 1)),
                 Some(position) => (piece.slice_to(position), piece.slice_from(position + 1)),
-                None => if isindex { (&[], piece) } else { (piece, &[]) }
+                None => {
+                    let tmp: (&[u8], &[u8]) = if isindex { (&[], piece) } else { (piece, &[]) };
+                    tmp
+                }
             };
             };
             let name = replace_plus(name);
             let name = replace_plus(name);
             let value = replace_plus(value);
             let value = replace_plus(value);

+ 2 - 2
src/host.rs

@@ -74,9 +74,9 @@ impl Host {
             // TODO: Remove this check and use IDNA "domain to ASCII"
             // TODO: Remove this check and use IDNA "domain to ASCII"
             if !domain.as_slice().is_ascii() {
             if !domain.as_slice().is_ascii() {
                 Err(NonAsciiDomainsNotSupportedYet)
                 Err(NonAsciiDomainsNotSupportedYet)
-            } else if domain.as_slice().find(&[
+            } else if domain.as_slice().find([
                 '\0', '\t', '\n', '\r', ' ', '#', '%', '/', ':', '?', '@', '[', '\\', ']'
                 '\0', '\t', '\n', '\r', ' ', '#', '%', '/', ':', '?', '@', '[', '\\', ']'
-            ]).is_some() {
+            ].as_slice()).is_some() {
                 Err(InvalidDomainCharacter)
                 Err(InvalidDomainCharacter)
             } else {
             } else {
                 Ok(Domain(domain.into_string().into_ascii_lower()))
                 Ok(Domain(domain.into_string().into_ascii_lower()))

+ 1 - 1
src/parser.rs

@@ -100,7 +100,7 @@ pub enum Context {
 
 
 
 
 pub fn parse_url(input: &str, parser: &UrlParser) -> ParseResult<Url> {
 pub fn parse_url(input: &str, parser: &UrlParser) -> ParseResult<Url> {
-    let input = input.trim_chars(&[' ', '\t', '\n', '\r', '\x0C']);
+    let input = input.trim_chars([' ', '\t', '\n', '\r', '\x0C'].as_slice());
     let (scheme, remaining) = match parse_scheme(input, UrlParserContext) {
     let (scheme, remaining) = match parse_scheme(input, UrlParserContext) {
         Some((scheme, remaining)) => (scheme, remaining),
         Some((scheme, remaining)) => (scheme, remaining),
         // No-scheme state
         // No-scheme state