1
0
Fork 0
mirror of https://gitlab.com/news-flash/article_scraper.git synced 2025-07-07 16:15:32 +02:00

fix clippy lints

This commit is contained in:
Jan Lukas Gernert 2021-01-06 10:32:43 +01:00
parent 3138d664d6
commit b73448b189
2 changed files with 4 additions and 10 deletions

View file

@ -191,7 +191,7 @@ impl GrabberConfig {
}
}
fn split_values<'a>(values: &'a str) -> Vec<&'a str> {
fn split_values(values: &str) -> Vec<&str> {
values.split('|').map(|s| s.trim()).collect()
}
}

View file

@ -508,10 +508,7 @@ impl ArticleScraper {
tag: Option<&str>,
attribute: &str,
) -> Result<(), ScraperError> {
let xpath_tag = match tag {
Some(tag) => tag,
None => "*",
};
let xpath_tag = tag.unwrap_or("*");
let xpath = &format!("//{}[@{}]", xpath_tag, attribute);
let node_vec = Self::evaluate_xpath(context, xpath, false)?;
@ -529,10 +526,7 @@ impl ArticleScraper {
attribute: &str,
value: &str,
) -> Result<(), ScraperError> {
let xpath_tag = match tag {
Some(tag) => tag,
None => "*",
};
let xpath_tag = tag.unwrap_or("*");
let xpath = &format!("//{}", xpath_tag);
let node_vec = Self::evaluate_xpath(context, xpath, false)?;
@ -598,7 +592,7 @@ impl ArticleScraper {
}
if !completed_url.ends_with('/') && !incomplete_url.starts_with('/') {
completed_url.push_str("/");
completed_url.push('/');
}
completed_url.push_str(incomplete_url);
let url = url::Url::parse(&completed_url).context(ScraperErrorKind::Url)?;