Fix #9508: Beautify our union enums constructors

This commit is contained in:
Alexander Lopatin 2016-02-07 02:55:21 +03:00
parent 7c249b1d53
commit 2be49404be
13 changed files with 69 additions and 71 deletions

View file

@ -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.