Skip to content

Fix building with current rust #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/form_urlencoded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I’d prefer [].as_slice(). Does that work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the special rules for let foo = &rvalue expand the lifetime of the vector here. Those rules don't apply for [].as_slice() so you get a lifetime error.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unfortunate, but oh well.

}
};
let name = replace_plus(name);
let value = replace_plus(value);
Expand Down
4 changes: 2 additions & 2 deletions src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
} else {
Ok(Domain(domain.into_string().into_ascii_lower()))
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down