Replace the remaining to_string calls by into_string calls.

This commit is contained in:
Ms2ger 2014-12-27 16:48:27 +01:00
parent 37a97f3273
commit b6117a57aa
12 changed files with 43 additions and 42 deletions

View file

@ -39,10 +39,10 @@ macro_rules! css_properties(
( $([$getter:ident, $setter:ident, $cssprop:expr]),* ) => (
$(
fn $getter(self) -> DOMString {
self.GetPropertyValue($cssprop.to_string())
self.GetPropertyValue($cssprop.into_string())
}
fn $setter(self, value: DOMString) {
self.SetPropertyValue($cssprop.to_string(), value).unwrap();
self.SetPropertyValue($cssprop.into_string(), value).unwrap();
}
)*
);
@ -123,7 +123,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
}
});
result.unwrap_or("".to_string())
result.unwrap_or("".into_string())
}
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue
@ -145,7 +145,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
// Step 2.2.2 & 2.2.3
match declaration {
Some(declaration) => list.push(declaration),
None => return "".to_string(),
None => return "".into_string(),
}
}
@ -157,7 +157,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
if let Some(ref declaration) = self.get_declaration(&property) {
serialize_value(declaration)
} else {
"".to_string()
"".into_string()
}
}
@ -174,15 +174,15 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
.map(|longhand| self.GetPropertyPriority(longhand.clone()))
.all(|priority| priority.as_slice() == "important") {
return "important".to_string();
return "important".into_string();
}
// Step 3
} else if self.get_important_declaration(&property).is_some() {
return "important".to_string();
return "important".into_string();
}
// Step 4
"".to_string()
"".into_string()
}
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setproperty
@ -287,7 +287,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setpropertyvalue
fn SetPropertyValue(self, property: DOMString, value: DOMString) -> ErrorResult {
self.SetProperty(property, value, "".to_string())
self.SetProperty(property, value, "".into_string())
}
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty
@ -326,12 +326,12 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat
fn CssFloat(self) -> DOMString {
self.GetPropertyValue("float".to_string())
self.GetPropertyValue("float".into_string())
}
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat
fn SetCssFloat(self, value: DOMString) -> ErrorResult {
self.SetPropertyValue("float".to_string(), value)
self.SetPropertyValue("float".into_string(), value)
}
fn IndexedGetter(self, index: u32, found: &mut bool) -> DOMString {

View file

@ -167,7 +167,7 @@ impl<'a> HTMLElementCustomAttributeHelpers for JSRef<'a, HTMLElement> {
let element: JSRef<Element> = ElementCast::from_ref(self);
element.get_attribute(ns!(""), &Atom::from_slice(to_snake_case(name).as_slice())).map(|attr| {
let attr = attr.root();
attr.value().as_slice().to_string()
attr.value().as_slice().into_string()
})
}

View file

@ -210,7 +210,7 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> {
window.evaluate_script_with_result(source.as_slice(), url.serialize().as_slice());
let event = Event::new(GlobalRef::Window(*window),
"load".to_string(),
"load".into_string(),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable).root();
event.set_trusted(true);

View file

@ -1199,7 +1199,7 @@ impl ScriptTask {
let y = point.y.to_i32().unwrap_or(0);
let mouse_event = MouseEvent::new(*window,
"mousemove".to_string(),
"mousemove".into_string(),
true,
true,
Some(*window),