From 555940f0659e95de7f890ede48e2faba096b3d6d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 18 Jan 2021 22:50:39 +0100 Subject: [PATCH] Use enumerate() --- src/nix/build.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nix/build.cc b/src/nix/build.cc index 4cb8ade08..45f63bb7e 100644 --- a/src/nix/build.cc +++ b/src/nix/build.cc @@ -58,7 +58,7 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile if (outLink != "") if (auto store2 = store.dynamic_pointer_cast()) - for (size_t i = 0; i < buildables.size(); ++i) + for (const auto & [i, buildable] : enumerate(buildables)) { std::visit(overloaded { [&](BuildableOpaque bo) { std::string symlink = outLink; @@ -74,7 +74,8 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile store2->addPermRoot(output.second, absPath(symlink)); } }, - }, buildables[i]); + }, buildable); + } updateProfile(buildables);