vc=56 fixup: bind QName temporary before passing to local_name
quick-xml's BytesStart::name() returns a borrowed QName; calling .as_ref() on it produced a &[u8] that outlived the QName by one expression — borrowck E0716. Hoist the QName to a local so it lives the full match arm.
This commit is contained in:
parent
3a57696b46
commit
12acf41c08
1 changed files with 6 additions and 3 deletions
|
|
@ -148,7 +148,8 @@ fn parse_rss(body: &str, channel_id: String) -> Option<Vec<SearchItem>> {
|
|||
loop {
|
||||
match reader.read_event_into(&mut buf) {
|
||||
Ok(Event::Start(e)) => {
|
||||
let local = local_name(e.name().as_ref());
|
||||
let name = e.name();
|
||||
let local = local_name(name.as_ref());
|
||||
if local == "entry" {
|
||||
in_entry = true;
|
||||
depth = 0;
|
||||
|
|
@ -176,7 +177,8 @@ fn parse_rss(body: &str, channel_id: String) -> Option<Vec<SearchItem>> {
|
|||
if !in_entry {
|
||||
continue;
|
||||
}
|
||||
let local = local_name(e.name().as_ref());
|
||||
let name = e.name();
|
||||
let local = local_name(name.as_ref());
|
||||
// <media:thumbnail url="..."/> is self-closing.
|
||||
if local == "thumbnail" {
|
||||
for attr in e.attributes().flatten() {
|
||||
|
|
@ -207,7 +209,8 @@ fn parse_rss(body: &str, channel_id: String) -> Option<Vec<SearchItem>> {
|
|||
if !in_entry {
|
||||
continue;
|
||||
}
|
||||
let local = local_name(e.name().as_ref());
|
||||
let name = e.name();
|
||||
let local = local_name(name.as_ref());
|
||||
if local == "entry" {
|
||||
if !video_id.is_empty() {
|
||||
items.push(SearchItem {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue