code cleanup
This commit is contained in:
parent
6bcb06a32f
commit
115c72e801
1 changed files with 3 additions and 5 deletions
|
@ -63,23 +63,21 @@ fn parse_xml(xml: &str) -> String {
|
||||||
let mut value = String::new();
|
let mut value = String::new();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let mut found = false;
|
let mut _found = false;
|
||||||
|
|
||||||
match reader.read_event() {
|
match reader.read_event() {
|
||||||
Err(e) => panic!("Error at position {}: {:?}", reader.buffer_position(), e),
|
Err(e) => panic!("Error at position {}: {:?}", reader.buffer_position(), e),
|
||||||
// exits the loop when reaching end of file
|
|
||||||
Ok(Event::Eof) => break,
|
Ok(Event::Eof) => break,
|
||||||
|
|
||||||
Ok(Event::Start(e)) => match e.name().as_ref() {
|
Ok(Event::Start(e)) => match e.name().as_ref() {
|
||||||
b"value" => found = true,
|
b"value" => (), //found = true,
|
||||||
_ => (),
|
_ => (),
|
||||||
},
|
},
|
||||||
Ok(Event::Text(e)) => value = e.unescape().unwrap().to_owned().to_string(),
|
Ok(Event::Text(e)) => value = e.unescape().unwrap().to_owned().to_string(),
|
||||||
|
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
// if we don't keep a borrow elsewhere, we can clear the buffer to keep memory usage low
|
|
||||||
//buf.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
value
|
value
|
||||||
|
|
Loading…
Reference in a new issue