From f547080df53076711b52a016b990c5be56f42ede Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 21 Mar 2015 16:53:03 +0100 Subject: [PATCH] fix(rustup): 1.0.0-nightly (e2fa53e59 2015-03-20) * replace `char_at()` calls with itertor, as suggested by compiler * fixed comparison in test --- src/header/common/host.rs | 4 +++- src/header/shared/entity.rs | 2 +- src/server/mod.rs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/header/common/host.rs b/src/header/common/host.rs index 5b0ee9da..e65fade4 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 2388b677..18b05ce9 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 5b718d2a..368e443d 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"[..]); } }