diff options
author | Ravi Shankar <wafflespeanut@gmail.com> | 2015-09-26 00:51:04 +0530 |
---|---|---|
committer | Ravi Shankar <wafflespeanut@gmail.com> | 2015-09-26 00:51:04 +0530 |
commit | 35d7ced89e164e778f9dd29ca5f8dc3a8aca8bdf (patch) | |
tree | 27bf792553a1f8df67ddd4159a7a6c0974500443 | |
parent | e04c2c78ee43ad81f2794d908a13744b6b976443 (diff) | |
download | servo-35d7ced89e164e778f9dd29ca5f8dc3a8aca8bdf.tar.gz servo-35d7ced89e164e778f9dd29ca5f8dc3a8aca8bdf.zip |
fixed the 'as_slice' deprecated warning
-rw-r--r-- | components/script/dom/websocket.rs | 7 | ||||
-rw-r--r-- | components/script/lib.rs | 1 |
2 files changed, 4 insertions, 4 deletions
diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index 304ea11e05a..279447070d0 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -32,8 +32,8 @@ use script_task::ScriptTaskEventCategory::WebSocketEvent; use script_task::{CommonScriptMsg, Runnable}; use std::borrow::ToOwned; use std::cell::{Cell, RefCell}; -use std::ptr; use std::sync::{Arc, Mutex}; +use std::{ptr, slice}; use util::str::DOMString; use util::task::spawn_named; use websocket::client::receiver::Receiver; @@ -139,7 +139,9 @@ impl WebSocket { // Step 3: Potentially block access to some ports. // Step 4. - let protocols = protocols.as_slice(); + let protocols: &[DOMString] = protocols + .as_ref() + .map_or(&[], |ref string| slice::ref_slice(string)); // Step 5. for (i, protocol) in protocols.iter().enumerate() { @@ -151,7 +153,6 @@ impl WebSocket { if protocols[i + 1..].iter().any(|p| p == protocol) { return Err(Syntax); - } if protocol.chars().any(|c| c < '\u{0021}' || c > '\u{007E}') { diff --git a/components/script/lib.rs b/components/script/lib.rs index 1380502957e..40df1c66ed2 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![feature(ascii)] -#![feature(as_slice)] #![feature(as_unsafe_cell)] #![feature(borrow_state)] #![feature(box_syntax)] |