Auto merge of #7741 - Wafflespeanut:warning_fix, r=jdm

fixed the deprecated `as_slice` warning...

I've put its original implementation from [`core/option.rs`](http://doc.servo.org/src/core/option.rs.html#692) instead of the dear departed `as_slice`

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7741)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-09-25 13:47:37 -06:00
commit b7c003f158
2 changed files with 4 additions and 4 deletions

View file

@ -32,8 +32,8 @@ use script_task::ScriptTaskEventCategory::WebSocketEvent;
use script_task::{CommonScriptMsg, Runnable}; use script_task::{CommonScriptMsg, Runnable};
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::ptr;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::{ptr, slice};
use util::str::DOMString; use util::str::DOMString;
use util::task::spawn_named; use util::task::spawn_named;
use websocket::client::receiver::Receiver; use websocket::client::receiver::Receiver;
@ -139,7 +139,9 @@ impl WebSocket {
// Step 3: Potentially block access to some ports. // Step 3: Potentially block access to some ports.
// Step 4. // Step 4.
let protocols = protocols.as_slice(); let protocols: &[DOMString] = protocols
.as_ref()
.map_or(&[], |ref string| slice::ref_slice(string));
// Step 5. // Step 5.
for (i, protocol) in protocols.iter().enumerate() { for (i, protocol) in protocols.iter().enumerate() {
@ -151,7 +153,6 @@ impl WebSocket {
if protocols[i + 1..].iter().any(|p| p == protocol) { if protocols[i + 1..].iter().any(|p| p == protocol) {
return Err(Syntax); return Err(Syntax);
} }
if protocol.chars().any(|c| c < '\u{0021}' || c > '\u{007E}') { if protocol.chars().any(|c| c < '\u{0021}' || c > '\u{007E}') {

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(ascii)] #![feature(ascii)]
#![feature(as_slice)]
#![feature(as_unsafe_cell)] #![feature(as_unsafe_cell)]
#![feature(borrow_state)] #![feature(borrow_state)]
#![feature(box_syntax)] #![feature(box_syntax)]