diff options
author | bors-servo <metajack+bors@gmail.com> | 2014-12-27 06:51:44 -0700 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2014-12-27 06:51:44 -0700 |
commit | 9857ea26cb9ee262654bee97322dbbf373486bff (patch) | |
tree | 07b07c50a612348705b7604453a9d5ab5cf105c3 /components/script/dom/node.rs | |
parent | 3af73e9962fe810de0c556693ec2eb0559b06a67 (diff) | |
parent | e0b88a9ca23b366830647568f4468cf055327434 (diff) | |
download | servo-9857ea26cb9ee262654bee97322dbbf373486bff.tar.gz servo-9857ea26cb9ee262654bee97322dbbf373486bff.zip |
auto merge of #4485 : servo/servo/into_string, r=Ms2ger
`str::to_string()` goes through a `Formatter`, `str::into_string()` is a direct copy and is apparently 5× faster.
This is a rebase of the boring and bitrot-prone parts of #4366.
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r-- | components/script/dom/node.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 1187e76a688..416a69f6035 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -843,17 +843,17 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> { NodeInfo { uniqueId: self.unique_id.borrow().clone(), - baseURI: self.GetBaseURI().unwrap_or("".to_string()), - parent: self.GetParentNode().root().map(|node| node.get_unique_id()).unwrap_or("".to_string()), + baseURI: self.GetBaseURI().unwrap_or("".into_string()), + parent: self.GetParentNode().root().map(|node| node.get_unique_id()).unwrap_or("".into_string()), nodeType: self.NodeType() as uint, - namespaceURI: "".to_string(), //FIXME + namespaceURI: "".into_string(), //FIXME nodeName: self.NodeName(), numChildren: self.ChildNodes().root().Length() as uint, //FIXME doctype nodes only - name: "".to_string(), - publicId: "".to_string(), - systemId: "".to_string(), + name: "".into_string(), + publicId: "".into_string(), + systemId: "".into_string(), attrs: match ElementCast::to_ref(self) { Some(element) => element.summarize(), @@ -866,7 +866,7 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> { .map(|elem| NodeCast::from_ref(*elem.root()) == self) .unwrap_or(false), - shortValue: self.GetNodeValue().unwrap_or("".to_string()), //FIXME: truncate + shortValue: self.GetNodeValue().unwrap_or("".into_string()), //FIXME: truncate incompleteValue: false, //FIXME: reflect truncation } } @@ -1551,7 +1551,7 @@ impl Node { local: element.local_name().clone() }; let element = Element::create(name, - element.prefix().as_ref().map(|p| p.as_slice().to_string()), + element.prefix().as_ref().map(|p| p.as_slice().into_string()), *document, ElementCreator::ScriptCreated); NodeCast::from_temporary(element) }, @@ -1664,19 +1664,19 @@ impl<'a> NodeMethods for JSRef<'a, Node> { let elem: JSRef<Element> = ElementCast::to_ref(self).unwrap(); elem.TagName() } - NodeTypeId::Text => "#text".to_string(), + NodeTypeId::Text => "#text".into_string(), NodeTypeId::ProcessingInstruction => { let processing_instruction: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(self).unwrap(); processing_instruction.Target() } - NodeTypeId::Comment => "#comment".to_string(), + NodeTypeId::Comment => "#comment".into_string(), NodeTypeId::DocumentType => { let doctype: JSRef<DocumentType> = DocumentTypeCast::to_ref(self).unwrap(); doctype.name().clone() }, - NodeTypeId::DocumentFragment => "#document-fragment".to_string(), - NodeTypeId::Document => "#document".to_string() + NodeTypeId::DocumentFragment => "#document-fragment".into_string(), + NodeTypeId::Document => "#document".into_string() } } |