Skip to content

Commit

Permalink
Use immediate format interpolation where possible
Browse files Browse the repository at this point in the history
Signed-off-by: Teo Klestrup Röijezon <teo@nullable.se>
  • Loading branch information
nightkr committed Oct 14, 2022
1 parent b2e5f77 commit 468bb81
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion kube-runtime/src/controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl Display for ReconcileReason {
ReconcileReason::Unknown => f.write_str("unknown"),
ReconcileReason::ObjectUpdated => f.write_str("object updated"),
ReconcileReason::RelatedObjectUpdated { obj_ref: object } => {
f.write_fmt(format_args!("related object updated: {}", object))
f.write_fmt(format_args!("related object updated: {object}"))
}
ReconcileReason::BulkReconcile => f.write_str("bulk reconcile requested"),
ReconcileReason::ReconcilerRequestedRetry => f.write_str("reconciler requested retry"),
Expand Down
2 changes: 1 addition & 1 deletion kube-runtime/src/finalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ where
// Short-circuit, so that we keep the finalizer if cleanup fails
.map_err(Error::CleanupFailed)?;
// Cleanup was successful, remove the finalizer so that deletion can continue
let finalizer_path = format!("/metadata/finalizers/{}", finalizer_i);
let finalizer_path = format!("/metadata/finalizers/{finalizer_i}");
api.patch::<K>(
&name,
&PatchParams::default(),
Expand Down
8 changes: 4 additions & 4 deletions kube-runtime/src/reflector/object_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl<K: Resource> Display for ObjectRef<K> {
self.name
)?;
if let Some(namespace) = &self.namespace {
write!(f, ".{}", namespace)?;
write!(f, ".{namespace}")?;
}
Ok(())
}
Expand Down Expand Up @@ -251,11 +251,11 @@ mod tests {
#[test]
fn display_should_be_transparent_to_representation() {
let pod_ref = ObjectRef::<Pod>::new("my-pod").within("my-namespace");
assert_eq!(format!("{}", pod_ref), format!("{}", pod_ref.erase()));
assert_eq!(format!("{pod_ref}"), format!("{}", pod_ref.erase()));
let deploy_ref = ObjectRef::<Deployment>::new("my-deploy").within("my-namespace");
assert_eq!(format!("{}", deploy_ref), format!("{}", deploy_ref.erase()));
assert_eq!(format!("{deploy_ref}"), format!("{}", deploy_ref.erase()));
let node_ref = ObjectRef::<Node>::new("my-node");
assert_eq!(format!("{}", node_ref), format!("{}", node_ref.erase()));
assert_eq!(format!("{node_ref}"), format!("{}", node_ref.erase()));
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion kube-runtime/src/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ pub fn watch_object<K: Resource + Clone + DeserializeOwned + Debug + Send + 'sta
name: &str,
) -> impl Stream<Item = Result<Option<K>>> + Send {
watcher(api, ListParams {
field_selector: Some(format!("metadata.name={}", name)),
field_selector: Some(format!("metadata.name={name}")),
..Default::default()
})
.map(|event| match event? {
Expand Down

0 comments on commit 468bb81

Please sign in to comment.