Move to to_owned rather than into_string.

into_string has been removed from Rust.
This commit is contained in:
Ms2ger 2015-01-20 14:45:36 +01:00
parent 2d5b0e0855
commit 01ed338746
67 changed files with 473 additions and 383 deletions

View file

@ -674,7 +674,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
default = "None"
else:
assert defaultValue.type.tag() == IDLType.Tags.domstring
value = "str::from_utf8(&data).unwrap().into_string()"
value = "str::from_utf8(&data).unwrap().to_owned()"
if type.nullable():
value = "Some(%s)" % value
@ -4584,6 +4584,7 @@ class CGBindingRoot(CGThing):
'page::JSPageInfo',
'libc',
'servo_util::str::DOMString',
'std::borrow::ToOwned',
'std::cmp',
'std::iter::repeat',
'std::mem',

View file

@ -28,6 +28,7 @@ use js::jsval::{UndefinedValue, NullValue, BooleanValue, Int32Value, UInt32Value
use js::jsval::{StringValue, ObjectValue, ObjectOrNullValue};
use libc;
use std::borrow::ToOwned;
use std::default;
use std::slice;
@ -289,7 +290,7 @@ pub fn jsid_to_str(cx: *mut JSContext, id: jsid) -> DOMString {
impl FromJSValConvertible<StringificationBehavior> for DOMString {
fn from_jsval(cx: *mut JSContext, value: JSVal, nullBehavior: StringificationBehavior) -> Result<DOMString, ()> {
if nullBehavior == StringificationBehavior::Empty && value.is_null() {
Ok("".into_string())
Ok("".to_owned())
} else {
let jsstr = unsafe { JS_ValueToString(cx, value) };
if jsstr.is_null() {

View file

@ -6,6 +6,7 @@
//! The `ByteString` struct.
use std::borrow::ToOwned;
use std::hash::{Hash, sip};
use std::str;
use std::str::FromStr;
@ -154,6 +155,6 @@ impl Hash for ByteString {
impl FromStr for ByteString {
fn from_str(s: &str) -> Option<ByteString> {
Some(ByteString::new(s.into_string().into_bytes()))
Some(ByteString::new(s.to_owned().into_bytes()))
}
}