Fix building with current rust
@@ -52,7 +52,10 @@ pub fn parse_bytes(input: &[u8], encoding_override: Option<EncodingRef>,
} else {
let (name, value) = match piece.position_elem(&b'=') {
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 value = replace_plus(value);
@@ -74,9 +74,9 @@ impl Host {
// TODO: Remove this check and use IDNA "domain to ASCII"
if !domain.as_slice().is_ascii() {
Err(NonAsciiDomainsNotSupportedYet)
- } else if domain.as_slice().find(&[
+ } else if domain.as_slice().find([
'\0', '\t', '\n', '\r', ' ', '#', '%', '/', ':', '?', '@', '[', '\\', ']'
- ]).is_some() {
+ ].as_slice()).is_some() {
Err(InvalidDomainCharacter)
Ok(Domain(domain.into_string().into_ascii_lower()))
@@ -100,7 +100,7 @@ pub enum Context {
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) {
Some((scheme, remaining)) => (scheme, remaining),
// No-scheme state