fix(rustup): 1.0.0-nightly (e2fa53e59 2015-03-20)
* replace `char_at()` calls with itertor, as suggested by compiler * fixed comparison in test
This commit is contained in:
@@ -28,7 +28,9 @@ impl Header for Host {
|
|||||||
// https://github.com/servo/rust-url/issues/42
|
// https://github.com/servo/rust-url/issues/42
|
||||||
let idx = {
|
let idx = {
|
||||||
let slice = &s[..];
|
let slice = &s[..];
|
||||||
if slice.char_at(1) == '[' {
|
let mut chars = slice.chars();
|
||||||
|
chars.next();
|
||||||
|
if chars.next().unwrap() == '[' {
|
||||||
match slice.rfind(']') {
|
match slice.rfind(']') {
|
||||||
Some(idx) => {
|
Some(idx) => {
|
||||||
if slice.len() > idx + 2 {
|
if slice.len() > idx + 2 {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ impl FromStr for EntityTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The etag is weak if its first char is not a DQUOTE.
|
// The etag is weak if its first char is not a DQUOTE.
|
||||||
if slice.char_at(0) == '"' /* '"' */ {
|
if slice.chars().next().unwrap() == '"' /* '"' */ {
|
||||||
// No need to check if the last char is a DQUOTE,
|
// No need to check if the last char is a DQUOTE,
|
||||||
// we already did that above.
|
// we already did that above.
|
||||||
if check_slice_validity(slice.slice_chars(1, length-1)) {
|
if check_slice_validity(slice.slice_chars(1, length-1)) {
|
||||||
|
|||||||
@@ -264,6 +264,6 @@ mod tests {
|
|||||||
");
|
");
|
||||||
|
|
||||||
handle_connection(&mut mock, &Reject);
|
handle_connection(&mut mock, &Reject);
|
||||||
assert_eq!(mock.write, b"HTTP/1.1 417 Expectation Failed\r\n\r\n");
|
assert_eq!(mock.write, &b"HTTP/1.1 417 Expectation Failed\r\n\r\n"[..]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user