Skip to content

Commit

Permalink
Inline format args in cas_main (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronmondal committed Oct 25, 2023
1 parent f15146d commit 62a2c1e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cas/cas_main.rs
Expand Up @@ -82,7 +82,7 @@ async fn inner_main(cfg: CasConfig, server_start_timestamp: u64) -> Result<(), B
&name,
store_factory(&store_cfg, &store_manager, Some(store_metrics))
.await
.err_tip(|| format!("Failed to create store '{}'", name))?,
.err_tip(|| format!("Failed to create store '{name}'"))?,
);
}
}
Expand Down Expand Up @@ -133,7 +133,7 @@ async fn inner_main(cfg: CasConfig, server_start_timestamp: u64) -> Result<(), B
"connected_clients",
&1,
"The endpoint of the connected clients",
vec![("endpoint".into(), format!("{}", client).into())],
vec![("endpoint".into(), format!("{client}").into())],
);
}

Expand All @@ -154,7 +154,7 @@ async fn inner_main(cfg: CasConfig, server_start_timestamp: u64) -> Result<(), B
.enumerate()
.map(|(i, server_cfg)| {
let name = if server_cfg.name.is_empty() {
format!("{}", i)
format!("{i}")
} else {
server_cfg.name.clone()
};
Expand All @@ -163,7 +163,7 @@ async fn inner_main(cfg: CasConfig, server_start_timestamp: u64) -> Result<(), B
counter: Counter::default(),
server_start_ts: server_start_timestamp,
});
let server_metrics = root_metrics_registry.sub_registry_with_prefix(format!("server_{}", name));
let server_metrics = root_metrics_registry.sub_registry_with_prefix(format!("server_{name}"));
server_metrics.register_collector(Box::new(Collector::new(&connected_clients_mux)));

(server_cfg, connected_clients_mux)
Expand Down Expand Up @@ -342,7 +342,7 @@ async fn inner_main(cfg: CasConfig, server_start_timestamp: u64) -> Result<(), B
fn error_to_response<E: std::error::Error>(e: E) -> hyper::Response<Body> {
hyper::Response::builder()
.status(500)
.body(format!("Error: {:?}", e).into())
.body(format!("Error: {e:?}").into())
.unwrap()
}
let path = if prometheus_cfg.path.is_empty() {
Expand Down Expand Up @@ -442,7 +442,7 @@ async fn inner_main(cfg: CasConfig, server_start_timestamp: u64) -> Result<(), B
.await
.err_tip(|| "Could not make LocalWorker")?;
let name = if local_worker.name().is_empty() {
format!("worker_{}", i)
format!("worker_{i}")
} else {
local_worker.name().clone()
};
Expand All @@ -464,7 +464,7 @@ async fn inner_main(cfg: CasConfig, server_start_timestamp: u64) -> Result<(), B
}

if let Err(e) = select_all(root_futures).await.0 {
panic!("{:?}", e);
panic!("{e:?}");
}
unreachable!("None of the futures should resolve in main()");
}
Expand Down

0 comments on commit 62a2c1e

Please sign in to comment.