2021 idioms

master
Edward Shen 2022-06-02 22:42:19 -07:00
parent ce592985ce
commit 90ff4461a6
Signed by: edward
GPG Key ID: 19182661E818369F
3 changed files with 5 additions and 5 deletions

View File

@ -417,7 +417,7 @@ mod read_config {
Err(BunBunError::ConfigTooLarge(size))
if size as usize == size_to_write => {}
Err(BunBunError::ConfigTooLarge(size)) => {
panic!("Mismatched size: {} != {}", size, size_to_write)
panic!("Mismatched size: {size} != {size_to_write}")
}
res => panic!("Wrong result, got {res:#?}"),
}

View File

@ -25,7 +25,7 @@ impl fmt::Display for BunBunError {
Self::Parse(e) => e.fmt(f),
Self::Watch(e) => e.fmt(f),
Self::LoggerInit(e) => e.fmt(f),
Self::CustomProgram(msg) => write!(f, "{}", msg),
Self::CustomProgram(msg) => msg.fmt(f),
Self::NoValidConfigPath => write!(f, "No valid config path was found!"),
Self::InvalidConfigPath(path, reason) => {
write!(f, "Failed to access {path:?}: {reason}")

View File

@ -123,7 +123,7 @@ pub async fn hop(
.status(StatusCode::OK)
.body(boxed(Full::new(Bytes::from(body)))),
Err(e) => {
error!("Failed to redirect user for {}: {}", path, e);
error!("Failed to redirect user for {path}: {e}");
Response::builder()
.status(StatusCode::INTERNAL_SERVER_ERROR)
.body(boxed(Full::from("Something went wrong :(\n")))
@ -173,7 +173,7 @@ fn resolve_hop<'a>(
let args = if args.is_empty() { &[] } else { &args[1..] }.join(" ");
let arg_count = arg_count - 1;
if check_route(route, arg_count) {
debug!("Resolved {} with args {}", route, args);
debug!("Resolved {route} with args {args}");
return RouteResolution::Resolved { route, args };
}
}
@ -183,7 +183,7 @@ fn resolve_hop<'a>(
if let Some(route) = routes.get(route) {
if check_route(route, arg_count) {
let args = args.join(" ");
debug!("Using default route {} with args {}", route, args);
debug!("Using default route {route} with args {args}");
return RouteResolution::Resolved { route, args };
}
}