2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 11:21:24 +00:00
This commit is contained in:
asonix 2023-01-29 11:57:59 -06:00
parent f6d6d54b88
commit 0aa3f574a5
9 changed files with 29 additions and 33 deletions

View file

@ -200,7 +200,7 @@ impl Display for Targets {
let targets = self
.targets
.iter()
.map(|(path, level)| format!("{}={}", path, level))
.map(|(path, level)| format!("{path}={level}"))
.collect::<Vec<_>>()
.join(",");
@ -226,12 +226,12 @@ impl Display for Targets {
if let Some(level) = max_level {
if !targets.is_empty() {
write!(f, "{},{}", level, targets)
write!(f, "{level},{targets}")
} else {
write!(f, "{}", level)
write!(f, "{level}")
}
} else if !targets.is_empty() {
write!(f, "{}", targets)
write!(f, "{targets}")
} else {
Ok(())
}
@ -246,7 +246,7 @@ impl FromStr for ImageFormat {
"jpeg" | "jpg" => Ok(Self::Jpeg),
"png" => Ok(Self::Png),
"webp" => Ok(Self::Webp),
other => Err(format!("Invalid variant: {}", other)),
other => Err(format!("Invalid variant: {other}")),
}
}
}
@ -260,7 +260,7 @@ impl FromStr for LogFormat {
return Ok(*variant);
}
}
Err(format!("Invalid variant: {}", s))
Err(format!("Invalid variant: {s}"))
}
}

View file

@ -41,7 +41,7 @@ where
.with(ErrorLayer::default());
if let Some(address) = tracing.console.address {
println!("Starting console on {}", address);
println!("Starting console on {address}");
let console_layer = ConsoleLayer::builder()
.event_buffer_capacity(tracing.console.buffer_capacity)

View file

@ -81,8 +81,8 @@ impl ResizeKind {
fn to_magick_string(self) -> String {
match self {
Self::Area(size) => format!("{}@>", size),
Self::Bounds(size) => format!("{}x{}>", size, size),
Self::Area(size) => format!("{size}@>"),
Self::Bounds(size) => format!("{size}x{size}>"),
}
}
}
@ -207,21 +207,21 @@ impl Processor for Resize {
filter: None,
kind: ResizeKind::Area(size),
} => {
let node = format!(".a{}", size);
let node = format!(".a{size}");
path.push(node);
}
Resize {
filter: Some(filter),
kind: ResizeKind::Bounds(size),
} => {
let node = format!("{}.{}", filter.to_magick_str(), size);
let node = format!("{}.{size}", filter.to_magick_str());
path.push(node);
}
Resize {
filter: Some(filter),
kind: ResizeKind::Area(size),
} => {
let node = format!("{}.a{}", filter.to_magick_str(), size);
let node = format!("{}.a{size}", filter.to_magick_str());
path.push(node);
}
}

View file

@ -190,8 +190,8 @@ async fn process_jobs<R, S, F>(
let res = job_loop(repo, store, worker_id.clone(), queue, callback).await;
if let Err(e) = res {
tracing::warn!("Error processing jobs: {}", format!("{}", e));
tracing::warn!("{}", format!("{:?}", e));
tracing::warn!("Error processing jobs: {}", format!("{e}"));
tracing::warn!("{}", format!("{e:?}"));
continue;
}

View file

@ -42,7 +42,7 @@ where
Cleanup::AllVariants => all_variants::<R, S>(repo).await?,
},
Err(e) => {
tracing::warn!("Invalid job: {}", format!("{}", e));
tracing::warn!("Invalid job: {}", format!("{e}"));
}
}
@ -72,7 +72,7 @@ where
let span = tracing::error_span!("Error deleting files");
span.in_scope(|| {
for error in errors {
tracing::error!("{}", format!("{}", error));
tracing::error!("{}", format!("{error}"));
}
});
}

View file

@ -58,7 +58,7 @@ where
}
},
Err(e) => {
tracing::warn!("Invalid job: {}", format!("{}", e));
tracing::warn!("Invalid job: {}", format!("{e}"));
}
}
@ -113,11 +113,7 @@ where
result
}
Err(e) => {
tracing::warn!(
"Failed to ingest {}, {}",
format!("{}", e),
format!("{:?}", e)
);
tracing::warn!("Failed to ingest {}, {}", format!("{e}"), format!("{e:?}"));
UploadResult::Failure {
message: e.to_string(),

View file

@ -486,7 +486,7 @@ impl Repo {
async {
for hash in old.hashes() {
if let Err(e) = migrate_hash(repo, &old, hash).await {
tracing::error!("Failed to migrate hash: {}", format!("{:?}", e));
tracing::error!("Failed to migrate hash: {}", format!("{e:?}"));
}
}
@ -529,7 +529,7 @@ impl Repo {
if let Err(e) = migrate_identifiers_for_hash(repo, hash).await {
tracing::error!(
"Failed to migrate identifiers for hash: {}",
format!("{:?}", e)
format!("{e:?}")
);
}
}
@ -831,8 +831,8 @@ impl std::fmt::Display for UploadId {
impl std::fmt::Display for MaybeUuid {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Uuid(id) => write!(f, "{}", id),
Self::Name(name) => write!(f, "{}", name),
Self::Uuid(id) => write!(f, "{id}"),
Self::Name(name) => write!(f, "{name}"),
}
}
}
@ -862,7 +862,7 @@ impl std::str::FromStr for Alias {
impl std::fmt::Display for Alias {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if let Some(ext) = self.extension() {
write!(f, "{}{}", self.id, ext)
write!(f, "{}{ext}", self.id)
} else {
write!(f, "{}", self.id)
}
@ -1001,7 +1001,7 @@ mod tests {
fn uuid_string_alias_ext() {
let uuid = Uuid::new_v4();
let alias_str = format!("{}.mp4", uuid);
let alias_str = format!("{uuid}.mp4");
let alias = Alias::from_existing(&alias_str);
assert_eq!(
@ -1091,7 +1091,7 @@ mod tests {
fn uuid_bytes_string_alias_ext() {
let uuid = Uuid::new_v4();
let alias_str = format!("{}.mp4", uuid);
let alias_str = format!("{uuid}.mp4");
let alias = Alias::from_slice(alias_str.as_bytes()).unwrap();
assert_eq!(

View file

@ -123,7 +123,7 @@ impl Old {
let filename_string = String::from_utf8_lossy(&filename);
let variant_prefix = format!("{}/", filename_string);
let variant_prefix = format!("{filename_string}/");
Ok(self
.identifier_tree
@ -157,7 +157,7 @@ impl Old {
let filename_string = String::from_utf8_lossy(&filename);
let motion_key = format!("{}/motion", filename_string);
let motion_key = format!("{filename_string}/motion");
Ok(self.filename_tree.get(motion_key)?)
}
@ -175,7 +175,7 @@ impl Old {
}
pub(super) fn delete_token(&self, alias: &Alias) -> color_eyre::Result<Option<DeleteToken>> {
let key = format!("{}/delete", alias);
let key = format!("{alias}/delete");
if let Some(ivec) = self.alias_tree.get(key)? {
return Ok(DeleteToken::from_slice(&ivec));

View file

@ -611,7 +611,7 @@ impl ObjectStore {
let path = self.next_directory().await?.to_strings().join("/");
let filename = uuid::Uuid::new_v4().to_string();
Ok(format!("{}/{}", path, filename))
Ok(format!("{path}/{filename}"))
}
}