chore: Use new stabilized let-chains feature

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb
2025-07-05 09:34:32 +00:00
parent 3fb7abe62a
commit 9e840be820
4 changed files with 25 additions and 24 deletions

View File

@@ -89,11 +89,12 @@ impl CliConfig {
pub fn load(file_path: PathBuf) -> N34Result<Self> {
tracing::info!(path = %file_path.display(), "Loading configuration from file");
// Make sure the file is exist
if let Some(parent) = file_path.parent() {
if !parent.exists() {
fs::create_dir_all(parent)?;
}
if let Some(parent) = file_path.parent()
&& !parent.exists()
{
fs::create_dir_all(parent)?;
}
let _ = fs::File::create_new(&file_path);
let mut config: Self =

View File

@@ -82,10 +82,10 @@ impl Cli {
pub fn post_cli(mut cli: Cli) -> N34Result<Cli> {
cli.options.pow = cli.options.pow.or(cli.options.config.pow);
if cli.options.relays.is_empty() {
if let Some(relays) = &cli.options.config.fallback_relays {
cli.options.relays = relays.iter().cloned().map(RelayOrSet::Relay).collect();
}
if cli.options.relays.is_empty()
&& let Some(relays) = &cli.options.config.fallback_relays
{
cli.options.relays = relays.iter().cloned().map(RelayOrSet::Relay).collect();
}
Ok(cli)