ok_or_else instead of ok_or improves performance -> linter suggestion
This commit is contained in:
parent
87c457a83e
commit
a6f504a5f2
|
@ -73,7 +73,7 @@ pub fn load_config(opts: &opts::Opts) -> anyhow::Result<Config> {
|
|||
None => {
|
||||
let confpath = ProjectDirs::from("me", "kaangenc", "gandi-dynamic-dns")
|
||||
.map(|dir| PathBuf::from(dir.config_dir()).join("config.toml"))
|
||||
.ok_or(anyhow::anyhow!("Can't find config directory"));
|
||||
.ok_or_else(|| anyhow::anyhow!("Can't find config directory"));
|
||||
confpath
|
||||
.and_then(|path| {
|
||||
println!("Checking for config: {}", path.to_string_lossy());
|
||||
|
|
Loading…
Reference in New Issue