refactor: conforms to clippy 1.67 recommandations

This commit is contained in:
VC
2023-02-09 11:32:22 +01:00
parent 6b68c8e299
commit f3b13eb62f
6 changed files with 19 additions and 22 deletions

View File

@@ -112,12 +112,12 @@ pub async fn base64_media(u: &str) -> Result<String, Box<dyn Error>> {
let content_type = response
.headers()
.get("content-type")
.ok_or_else(|| ScootalooError::new(&format!("Cannot get media content type for {}", u)))?
.ok_or_else(|| ScootalooError::new(&format!("Cannot get media content type for {u}")))?
.to_str()?;
let encoded_f = encode(buffer);
Ok(format!("data:{};base64,{}", content_type, encoded_f))
Ok(format!("data:{content_type};base64,{encoded_f}"))
}
/// Gets and caches Twitter Media inside the determined temp dir
@@ -134,19 +134,17 @@ pub async fn cache_media(u: &str, t: &str) -> Result<String, Box<dyn Error>> {
.path_segments()
.ok_or_else(|| {
ScootalooError::new(&format!(
"Cannot determine the destination filename for {}",
u
"Cannot determine the destination filename for {u}"
))
})?
.last()
.ok_or_else(|| {
ScootalooError::new(&format!(
"Cannot determine the destination filename for {}",
u
"Cannot determine the destination filename for {u}"
))
})?;
let dest_filepath = format!("{}/{}", t, dest_filename);
let dest_filepath = format!("{t}/{dest_filename}");
let mut dest_file = File::create(&dest_filepath).await?;