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
2fbd3cf824
commit
782f962c97
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 {
|
loop {
|
||||||
match reader.read_event_into(&mut buf) {
|
match reader.read_event_into(&mut buf) {
|
||||||
Ok(Event::Start(e)) => {
|
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" {
|
if local == "entry" {
|
||||||
in_entry = true;
|
in_entry = true;
|
||||||
depth = 0;
|
depth = 0;
|
||||||
|
|
@ -176,7 +177,8 @@ fn parse_rss(body: &str, channel_id: String) -> Option<Vec<SearchItem>> {
|
||||||
if !in_entry {
|
if !in_entry {
|
||||||
continue;
|
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.
|
// <media:thumbnail url="..."/> is self-closing.
|
||||||
if local == "thumbnail" {
|
if local == "thumbnail" {
|
||||||
for attr in e.attributes().flatten() {
|
for attr in e.attributes().flatten() {
|
||||||
|
|
@ -207,7 +209,8 @@ fn parse_rss(body: &str, channel_id: String) -> Option<Vec<SearchItem>> {
|
||||||
if !in_entry {
|
if !in_entry {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let local = local_name(e.name().as_ref());
|
let name = e.name();
|
||||||
|
let local = local_name(name.as_ref());
|
||||||
if local == "entry" {
|
if local == "entry" {
|
||||||
if !video_id.is_empty() {
|
if !video_id.is_empty() {
|
||||||
items.push(SearchItem {
|
items.push(SearchItem {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue