Refactor(CLI): avoid unnecessary unreachable! macro in CLI parsing (#3288)

* Refactor(CLI): avoid unnecessary `unreachable!` macro in CLI parsing

* Fix: clippy lint

---------

Co-authored-by: cxymds <Cxymds@qq.com>
Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
Maksim Vykhota
2026-06-09 17:01:51 +03:00
committed by GitHub
parent e79c793803
commit c4d0d395af
+7 -14
View File
@@ -147,21 +147,14 @@ async fn async_main() -> Result<()> {
} }
}; };
// Handle info command // Execute subcommand, or prepare config for `server` subcommand
if let rustfs::config::CommandResult::Info(opts) = command_result {
rustfs::config::execute_info(&opts);
return Ok(());
}
if let rustfs::config::CommandResult::Tls(opts) = &command_result {
rustfs::tls::execute_tls(opts)?;
return Ok(());
}
// Get config for server command
let config = match command_result { let config = match command_result {
rustfs::config::CommandResult::Server(cfg) => cfg, rustfs::config::CommandResult::Info(opts) => {
rustfs::config::CommandResult::Info(_) | rustfs::config::CommandResult::Tls(_) => unreachable!(), rustfs::config::execute_info(&opts);
return Ok(());
}
rustfs::config::CommandResult::Tls(opts) => return rustfs::tls::execute_tls(&opts),
rustfs::config::CommandResult::Server(config) => config,
}; };
// Initialize the global config snapshot for info command // Initialize the global config snapshot for info command