From 57a2e46ee0890093c9882f961d7d95c56d7c0ad5 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 3 Feb 2023 22:02:39 -0500 Subject: [PATCH] Slight cleanup of `InstallablesCommand::load` --- src/libcmd/installables.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc index 5603a4f2b..cfc13a60f 100644 --- a/src/libcmd/installables.cc +++ b/src/libcmd/installables.cc @@ -708,8 +708,8 @@ void InstallablesCommand::prepare() installables = load(); } -Installables InstallablesCommand::load() { - Installables installables; +Installables InstallablesCommand::load() +{ if (_installables.empty() && useDefaultInstallables()) // FIXME: commands like "nix profile install" should not have a // default, probably. @@ -719,11 +719,8 @@ Installables InstallablesCommand::load() { std::vector InstallablesCommand::getFlakesForCompletion() { - if (_installables.empty()) { - if (useDefaultInstallables()) - return {"."}; - return {}; - } + if (_installables.empty() && useDefaultInstallables()) + return {"."}; return _installables; }