reduce clones and fix some code styles and redundant code
This commit is contained in:
parent
5ba8931502
commit
63e19998d0
2 changed files with 7 additions and 8 deletions
|
@ -155,7 +155,7 @@ pub fn walk_and_embed_assets(
|
|||
|
||||
// If a network error occured, warn
|
||||
Err(e) => {
|
||||
eprintln!("Warning: {}", e,);
|
||||
eprintln!("Warning: {}", e);
|
||||
|
||||
// If failed to resolve, replace with absolute URL
|
||||
href_full_url
|
||||
|
@ -515,9 +515,7 @@ fn get_child_node_by_name(handle: &Handle, node_name: &str) -> Handle {
|
|||
});
|
||||
match matching_children {
|
||||
Some(node) => node.clone(),
|
||||
_ => {
|
||||
return handle.clone();
|
||||
}
|
||||
_ => handle.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,14 +28,15 @@ pub fn retrieve_asset(
|
|||
let mut response = client.get(url).send()?;
|
||||
|
||||
if !opt_silent {
|
||||
if url == response.url().as_str() {
|
||||
let res_url = response.url().as_str();
|
||||
if url == res_url {
|
||||
eprintln!("{}", &url);
|
||||
} else {
|
||||
eprintln!("{} -> {}", &url, &response.url().as_str());
|
||||
eprintln!("{} -> {}", &url, res_url);
|
||||
}
|
||||
}
|
||||
|
||||
let new_cache_key = clean_url(response.url().to_string());
|
||||
let new_cache_key = clean_url(response.url());
|
||||
|
||||
if as_dataurl {
|
||||
// Convert response into a byte array
|
||||
|
@ -54,7 +55,7 @@ pub fn retrieve_asset(
|
|||
};
|
||||
let dataurl = data_to_dataurl(&mimetype, &data);
|
||||
// insert in cache
|
||||
cache.insert(new_cache_key, dataurl.to_string());
|
||||
cache.insert(new_cache_key, dataurl.clone());
|
||||
Ok((dataurl, response.url().to_string()))
|
||||
} else {
|
||||
let content = response.text().unwrap();
|
||||
|
|
Loading…
Reference in a new issue