chore: Use new stabilized let-chains feature
Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
@@ -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 =
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user