mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 08:18:18 +00:00
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:
+7
-14
@@ -147,21 +147,14 @@ async fn async_main() -> Result<()> {
|
||||
}
|
||||
};
|
||||
|
||||
// Handle info command
|
||||
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
|
||||
// Execute subcommand, or prepare config for `server` subcommand
|
||||
let config = match command_result {
|
||||
rustfs::config::CommandResult::Server(cfg) => cfg,
|
||||
rustfs::config::CommandResult::Info(_) | rustfs::config::CommandResult::Tls(_) => unreachable!(),
|
||||
rustfs::config::CommandResult::Info(opts) => {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user