2021 idioms
This commit is contained in:
parent
ce592985ce
commit
90ff4461a6
3 changed files with 5 additions and 5 deletions
|
@ -417,7 +417,7 @@ mod read_config {
|
||||||
Err(BunBunError::ConfigTooLarge(size))
|
Err(BunBunError::ConfigTooLarge(size))
|
||||||
if size as usize == size_to_write => {}
|
if size as usize == size_to_write => {}
|
||||||
Err(BunBunError::ConfigTooLarge(size)) => {
|
Err(BunBunError::ConfigTooLarge(size)) => {
|
||||||
panic!("Mismatched size: {} != {}", size, size_to_write)
|
panic!("Mismatched size: {size} != {size_to_write}")
|
||||||
}
|
}
|
||||||
res => panic!("Wrong result, got {res:#?}"),
|
res => panic!("Wrong result, got {res:#?}"),
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl fmt::Display for BunBunError {
|
||||||
Self::Parse(e) => e.fmt(f),
|
Self::Parse(e) => e.fmt(f),
|
||||||
Self::Watch(e) => e.fmt(f),
|
Self::Watch(e) => e.fmt(f),
|
||||||
Self::LoggerInit(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::NoValidConfigPath => write!(f, "No valid config path was found!"),
|
||||||
Self::InvalidConfigPath(path, reason) => {
|
Self::InvalidConfigPath(path, reason) => {
|
||||||
write!(f, "Failed to access {path:?}: {reason}")
|
write!(f, "Failed to access {path:?}: {reason}")
|
||||||
|
|
|
@ -123,7 +123,7 @@ pub async fn hop(
|
||||||
.status(StatusCode::OK)
|
.status(StatusCode::OK)
|
||||||
.body(boxed(Full::new(Bytes::from(body)))),
|
.body(boxed(Full::new(Bytes::from(body)))),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Failed to redirect user for {}: {}", path, e);
|
error!("Failed to redirect user for {path}: {e}");
|
||||||
Response::builder()
|
Response::builder()
|
||||||
.status(StatusCode::INTERNAL_SERVER_ERROR)
|
.status(StatusCode::INTERNAL_SERVER_ERROR)
|
||||||
.body(boxed(Full::from("Something went wrong :(\n")))
|
.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 args = if args.is_empty() { &[] } else { &args[1..] }.join(" ");
|
||||||
let arg_count = arg_count - 1;
|
let arg_count = arg_count - 1;
|
||||||
if check_route(route, arg_count) {
|
if check_route(route, arg_count) {
|
||||||
debug!("Resolved {} with args {}", route, args);
|
debug!("Resolved {route} with args {args}");
|
||||||
return RouteResolution::Resolved { route, args };
|
return RouteResolution::Resolved { route, args };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ fn resolve_hop<'a>(
|
||||||
if let Some(route) = routes.get(route) {
|
if let Some(route) = routes.get(route) {
|
||||||
if check_route(route, arg_count) {
|
if check_route(route, arg_count) {
|
||||||
let args = args.join(" ");
|
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 };
|
return RouteResolution::Resolved { route, args };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue