refine clap::Parser

This commit is contained in:
ssrlive 2025-01-02 17:05:32 +08:00
parent ea5ee834db
commit 2a8e31225c
2 changed files with 2 additions and 5 deletions

View file

@ -181,8 +181,7 @@ impl Default for Args {
impl Args {
#[allow(clippy::let_and_return)]
pub fn parse_args() -> Self {
use clap::Parser;
let args = Self::parse();
let args = <Self as ::clap::Parser>::parse();
#[cfg(target_os = "linux")]
if !args.setup && args.tun.is_none() {
eprintln!("Missing required argument, '--tun' must present when '--setup' is not used.");

View file

@ -54,10 +54,8 @@ pub struct UdpGwArgs {
}
impl UdpGwArgs {
#[allow(clippy::let_and_return)]
pub fn parse_args() -> Self {
use clap::Parser;
Self::parse()
<Self as ::clap::Parser>::parse()
}
}