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

View File

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

View File

@ -81,8 +81,8 @@ impl ResizeKind {
fn to_magick_string(self) -> String { fn to_magick_string(self) -> String {
match self { match self {
Self::Area(size) => format!("{}@>", size), Self::Area(size) => format!("{size}@>"),
Self::Bounds(size) => format!("{}x{}>", size, size), Self::Bounds(size) => format!("{size}x{size}>"),
} }
} }
} }
@ -207,21 +207,21 @@ impl Processor for Resize {
filter: None, filter: None,
kind: ResizeKind::Area(size), kind: ResizeKind::Area(size),
} => { } => {
let node = format!(".a{}", size); let node = format!(".a{size}");
path.push(node); path.push(node);
} }
Resize { Resize {
filter: Some(filter), filter: Some(filter),
kind: ResizeKind::Bounds(size), kind: ResizeKind::Bounds(size),
} => { } => {
let node = format!("{}.{}", filter.to_magick_str(), size); let node = format!("{}.{size}", filter.to_magick_str());
path.push(node); path.push(node);
} }
Resize { Resize {
filter: Some(filter), filter: Some(filter),
kind: ResizeKind::Area(size), 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); 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; let res = job_loop(repo, store, worker_id.clone(), queue, callback).await;
if let Err(e) = res { if let Err(e) = res {
tracing::warn!("Error processing jobs: {}", format!("{}", e)); tracing::warn!("Error processing jobs: {}", format!("{e}"));
tracing::warn!("{}", format!("{:?}", e)); tracing::warn!("{}", format!("{e:?}"));
continue; continue;
} }

View File

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

View File

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

View File

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

View File

@ -123,7 +123,7 @@ impl Old {
let filename_string = String::from_utf8_lossy(&filename); let filename_string = String::from_utf8_lossy(&filename);
let variant_prefix = format!("{}/", filename_string); let variant_prefix = format!("{filename_string}/");
Ok(self Ok(self
.identifier_tree .identifier_tree
@ -157,7 +157,7 @@ impl Old {
let filename_string = String::from_utf8_lossy(&filename); 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)?) 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>> { 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)? { if let Some(ivec) = self.alias_tree.get(key)? {
return Ok(DeleteToken::from_slice(&ivec)); return Ok(DeleteToken::from_slice(&ivec));

View File

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