aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-12-27 16:48:27 +0100
committerMs2ger <ms2ger@gmail.com>2014-12-31 10:34:44 +0100
commitb6117a57aae0fe39e64417ba9b8afdb2f701c9ef (patch)
treea071f05b702f07a86b6745119467b9e5aca13977
parent37a97f3273c442fa59a3f65e8300a2527b004036 (diff)
downloadservo-b6117a57aae0fe39e64417ba9b8afdb2f701c9ef.tar.gz
servo-b6117a57aae0fe39e64417ba9b8afdb2f701c9ef.zip
Replace the remaining to_string calls by into_string calls.
-rw-r--r--components/script/dom/cssstyledeclaration.rs22
-rw-r--r--components/script/dom/htmlelement.rs2
-rw-r--r--components/script/dom/htmlscriptelement.rs2
-rw-r--r--components/script/script_task.rs2
-rw-r--r--components/style/properties/mod.rs.mako8
-rw-r--r--components/util/opts.rs2
-rw-r--r--components/util/rtinstrument.rs2
-rw-r--r--components/util/smallvec.rs34
-rw-r--r--components/util/str.rs5
-rw-r--r--components/util/task.rs2
-rw-r--r--ports/cef/browser.rs2
-rw-r--r--ports/cef/core.rs2
12 files changed, 43 insertions, 42 deletions
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index 8b7228dc375..2e20b85f942 100644
--- a/components/script/dom/cssstyledeclaration.rs
+++ b/components/script/dom/cssstyledeclaration.rs
@@ -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 {
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs
index 46572ed76e0..27cfc3712a3 100644
--- a/components/script/dom/htmlelement.rs
+++ b/components/script/dom/htmlelement.rs
@@ -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()
})
}
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs
index 17c9820a344..eb1dfbabbd7 100644
--- a/components/script/dom/htmlscriptelement.rs
+++ b/components/script/dom/htmlscriptelement.rs
@@ -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);
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 443bb8c37d6..c1476780d61 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -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),
diff --git a/components/style/properties/mod.rs.mako b/components/style/properties/mod.rs.mako
index 4bfe6fe696b..68d4fabd46c 100644
--- a/components/style/properties/mod.rs.mako
+++ b/components/style/properties/mod.rs.mako
@@ -2484,7 +2484,7 @@ impl<T: Show> DeclaredValue<T> {
match self {
&DeclaredValue::SpecifiedValue(ref inner) => Some(format!("{}", inner)),
&DeclaredValue::Initial => None,
- &DeclaredValue::Inherit => Some("inherit".to_string()),
+ &DeclaredValue::Inherit => Some("inherit".into_string()),
}
}
}
@@ -2509,10 +2509,10 @@ impl PropertyDeclaration {
match self {
% for property in LONGHANDS:
% if property.derived_from is None:
- &PropertyDeclaration::${property.camel_case}Declaration(..) => "${property.name}".to_string(),
+ &PropertyDeclaration::${property.camel_case}Declaration(..) => "${property.name}".into_string(),
% endif
% endfor
- _ => "".to_string(),
+ _ => "".into_string(),
}
}
@@ -3201,7 +3201,7 @@ pub fn longhands_from_shorthand(shorthand: &str) -> Option<Vec<String>> {
% for property in SHORTHANDS:
"${property.name}" => Some(vec!(
% for sub in property.sub_properties:
- "${sub.name}".to_string(),
+ "${sub.name}".into_string(),
% endfor
)),
% endfor
diff --git a/components/util/opts.rs b/components/util/opts.rs
index 1689321fa6e..6bd1882b94e 100644
--- a/components/util/opts.rs
+++ b/components/util/opts.rs
@@ -297,7 +297,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
}
};
- let render_api = match opt_match.opt_str("r").unwrap_or("gl".to_string()).as_slice() {
+ let render_api = match opt_match.opt_str("r").unwrap_or("gl".into_string()).as_slice() {
"mesa" => RenderApi::Mesa,
"gl" => RenderApi::OpenGL,
_ => {
diff --git a/components/util/rtinstrument.rs b/components/util/rtinstrument.rs
index 7ad59bada22..0cd075c0545 100644
--- a/components/util/rtinstrument.rs
+++ b/components/util/rtinstrument.rs
@@ -83,7 +83,7 @@ pub fn instrument(f: proc()) {
let task = Local::borrow(None::<Task>);
match task.name {
Some(ref name) => name.to_string(),
- None => "unknown".to_string(),
+ None => "unknown".into_string(),
}
};
let stats = TaskStats {
diff --git a/components/util/smallvec.rs b/components/util/smallvec.rs
index e77b4872d2d..60e22f25a70 100644
--- a/components/util/smallvec.rs
+++ b/components/util/smallvec.rs
@@ -529,34 +529,34 @@ pub mod tests {
#[test]
pub fn test_inline() {
let mut v = SmallVec16::new();
- v.push("hello".to_string());
- v.push("there".to_string());
- assert_eq!(v.as_slice(), vec!["hello".to_string(), "there".to_string()].as_slice());
+ v.push("hello".into_string());
+ v.push("there".into_string());
+ assert_eq!(v.as_slice(), vec!["hello".into_string(), "there".into_string()].as_slice());
}
#[test]
pub fn test_spill() {
let mut v = SmallVec2::new();
- v.push("hello".to_string());
- v.push("there".to_string());
- v.push("burma".to_string());
- v.push("shave".to_string());
- assert_eq!(v.as_slice(), vec!["hello".to_string(), "there".to_string(), "burma".to_string(), "shave".to_string()].as_slice());
+ v.push("hello".into_string());
+ v.push("there".into_string());
+ v.push("burma".into_string());
+ v.push("shave".into_string());
+ assert_eq!(v.as_slice(), vec!["hello".into_string(), "there".into_string(), "burma".into_string(), "shave".into_string()].as_slice());
}
#[test]
pub fn test_double_spill() {
let mut v = SmallVec2::new();
- v.push("hello".to_string());
- v.push("there".to_string());
- v.push("burma".to_string());
- v.push("shave".to_string());
- v.push("hello".to_string());
- v.push("there".to_string());
- v.push("burma".to_string());
- v.push("shave".to_string());
+ v.push("hello".into_string());
+ v.push("there".into_string());
+ v.push("burma".into_string());
+ v.push("shave".into_string());
+ v.push("hello".into_string());
+ v.push("there".into_string());
+ v.push("burma".into_string());
+ v.push("shave".into_string());
assert_eq!(v.as_slice(), vec![
- "hello".to_string(), "there".to_string(), "burma".to_string(), "shave".to_string(), "hello".to_string(), "there".to_string(), "burma".to_string(), "shave".to_string(),
+ "hello".into_string(), "there".into_string(), "burma".into_string(), "shave".into_string(), "hello".into_string(), "there".into_string(), "burma".into_string(), "shave".into_string(),
].as_slice());
}
}
diff --git a/components/util/str.rs b/components/util/str.rs
index 4ada243391c..2344c8655d4 100644
--- a/components/util/str.rs
+++ b/components/util/str.rs
@@ -16,10 +16,11 @@ pub type StaticCharVec = &'static [char];
pub type StaticStringVec = &'static [&'static str];
pub fn null_str_as_empty(s: &Option<DOMString>) -> DOMString {
- // We don't use map_default because it would allocate "".to_string() even for Some.
+ // We don't use map_default because it would allocate "".into_string() even
+ // for Some.
match *s {
Some(ref s) => s.clone(),
- None => "".to_string()
+ None => "".into_string()
}
}
diff --git a/components/util/task.rs b/components/util/task.rs
index 5af0ce9cff0..6047fdb3dae 100644
--- a/components/util/task.rs
+++ b/components/util/task.rs
@@ -42,7 +42,7 @@ pub fn spawn_named_with_send_on_failure<T: Send>(name: &'static str,
TaskBuilder::new().named(name).try_future(with_state)
};
- let watched_name = name.to_string();
+ let watched_name = name.into_string();
let watcher_name = format!("{}Watcher", watched_name);
TaskBuilder::new().named(watcher_name).spawn(proc() {
rtinstrument::instrument(proc() {
diff --git a/ports/cef/browser.rs b/ports/cef/browser.rs
index 16d32658c77..98993532df6 100644
--- a/ports/cef/browser.rs
+++ b/ports/cef/browser.rs
@@ -107,7 +107,7 @@ fn browser_host_create(window_info: &cef_window_info_t,
callback_executed: bool)
-> CefBrowser {
let mut urls = Vec::new();
- urls.push("http://s27.postimg.org/vqbtrolyr/servo.jpg".to_string());
+ urls.push("http://s27.postimg.org/vqbtrolyr/servo.jpg".into_string());
let mut opts = opts::default_opts();
opts.urls = urls;
let browser = ServoCefBrowser::new(window_info, client).as_cef_interface();
diff --git a/ports/cef/core.rs b/ports/cef/core.rs
index 093db5188c8..c405bde596c 100644
--- a/ports/cef/core.rs
+++ b/ports/cef/core.rs
@@ -76,7 +76,7 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
message_queue.replace(Some(RefCell::new(Vec::new())));
- let urls = vec![HOME_URL.to_string()];
+ let urls = vec![HOME_URL.into_string()];
opts::set_opts(opts::Opts {
urls: urls,
n_paint_threads: 1,