mirror of
https://framagit.org/veretcle/scootaloo.git
synced 2025-07-21 17:34:37 +02:00
refactor: conforms to clippy 1.67 recommandations
This commit is contained in:
12
src/util.rs
12
src/util.rs
@@ -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?;
|
||||
|
||||
|
Reference in New Issue
Block a user