mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Fix #9508: Beautify our union enums constructors
This commit is contained in:
parent
7c249b1d53
commit
2be49404be
13 changed files with 69 additions and 71 deletions
|
@ -1060,17 +1060,17 @@ impl Document {
|
|||
-> Fallible<Root<Node>> {
|
||||
if nodes.len() == 1 {
|
||||
Ok(match nodes.pop().unwrap() {
|
||||
NodeOrString::eNode(node) => node,
|
||||
NodeOrString::eString(string) => Root::upcast(self.CreateTextNode(string)),
|
||||
NodeOrString::Node(node) => node,
|
||||
NodeOrString::String(string) => Root::upcast(self.CreateTextNode(string)),
|
||||
})
|
||||
} else {
|
||||
let fragment = Root::upcast::<Node>(self.CreateDocumentFragment());
|
||||
for node in nodes {
|
||||
match node {
|
||||
NodeOrString::eNode(node) => {
|
||||
NodeOrString::Node(node) => {
|
||||
try!(fragment.AppendChild(node.r()));
|
||||
},
|
||||
NodeOrString::eString(string) => {
|
||||
NodeOrString::String(string) => {
|
||||
let node = Root::upcast::<Node>(self.CreateTextNode(string));
|
||||
// No try!() here because appending a text node
|
||||
// should not fail.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue