autoload: simplify conditional compilation

This commit is contained in:
Johannes Altmanninger
2025-09-06 14:24:17 +02:00
parent 78d46f4b47
commit f7648757f1

View File

@@ -341,15 +341,14 @@ fn check(
cmd: &wstr,
allow_stale: bool,
) -> Option<AutoloadableFileInfo> {
let asset_dir = cfg!(feature = "embed-data").then_some(()).and_then(|()| {
if env_var_name == "fish_function_path" {
Some(AssetDir::Functions)
} else if cfg!(feature = "embed-data") && env_var_name == "fish_complete_path" {
Some(AssetDir::Completions)
} else {
None
}
});
let asset_dir =
cfg!(feature = "embed-data")
.then_some(())
.and_then(|()| match env_var_name {
s if s == "fish_function_path" => Some(AssetDir::Functions),
s if s == "fish_complete_path" => Some(AssetDir::Completions),
_ => None,
});
// Check hits.
if let Some(value) = self.known_files.get(cmd) {