diff --git a/src/header/common/host.rs b/src/header/common/host.rs index 5b0ee9dace..e65fade4b4 100644 --- a/src/header/common/host.rs +++ b/src/header/common/host.rs @@ -28,7 +28,9 @@ impl Header for Host { // https://github.com/servo/rust-url/issues/42 let idx = { let slice = &s[..]; - if slice.char_at(1) == '[' { + let mut chars = slice.chars(); + chars.next(); + if chars.next().unwrap() == '[' { match slice.rfind(']') { Some(idx) => { if slice.len() > idx + 2 { diff --git a/src/header/shared/entity.rs b/src/header/shared/entity.rs index 2388b677d8..18b05ce938 100644 --- a/src/header/shared/entity.rs +++ b/src/header/shared/entity.rs @@ -52,7 +52,7 @@ impl FromStr for EntityTag { } // 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, // we already did that above. if check_slice_validity(slice.slice_chars(1, length-1)) { diff --git a/src/server/mod.rs b/src/server/mod.rs index 5b718d2a77..368e443dd9 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -264,6 +264,6 @@ mod tests { "); 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"[..]); } }