ok_or_else instead of ok_or improves performance -> linter suggestion

This commit is contained in:
jannikac 2022-12-06 23:23:46 +01:00
parent 87c457a83e
commit a6f504a5f2
1 changed files with 1 additions and 1 deletions

View File

@ -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());