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:
parent
3138d664d6
commit
b73448b189
2 changed files with 4 additions and 10 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
12
src/lib.rs
12
src/lib.rs
|
@ -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)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue