fix a FIXME, break value is now stable

This commit is contained in:
Emmanuel Gil Peyrot 2017-08-19 00:34:44 +01:00
parent 4546db95fc
commit 89ab8d9aca

View file

@ -269,14 +269,12 @@ impl Element {
/// Parse a document from an `EventReader`. /// Parse a document from an `EventReader`.
pub fn from_reader<R: BufRead>(reader: &mut EventReader<R>) -> Result<Element> { pub fn from_reader<R: BufRead>(reader: &mut EventReader<R>) -> Result<Element> {
let mut buf = Vec::new(); let mut buf = Vec::new();
let root: Element;
loop { let root: Element = loop {
let e = reader.read_event(&mut buf)?; let e = reader.read_event(&mut buf)?;
match e { match e {
Event::Empty(ref e) | Event::Start(ref e) => { Event::Empty(ref e) | Event::Start(ref e) => {
root = build_element(e)?; // FIXME: could be break build_element(e)? when break value is stable break build_element(e)?;
break;
}, },
Event::Eof => { Event::Eof => {
bail!(ErrorKind::EndOfDocument); bail!(ErrorKind::EndOfDocument);