about summary refs log tree commit diff
path: root/third_party/nix/src/libmain
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libmain')
-rw-r--r--third_party/nix/src/libmain/common-args.cc2
-rw-r--r--third_party/nix/src/libmain/shared.cc12
-rw-r--r--third_party/nix/src/libmain/shared.hh7
3 files changed, 12 insertions, 9 deletions
diff --git a/third_party/nix/src/libmain/common-args.cc b/third_party/nix/src/libmain/common-args.cc
index 9d6f6445c0e7..3d9b8ebfaefd 100644
--- a/third_party/nix/src/libmain/common-args.cc
+++ b/third_party/nix/src/libmain/common-args.cc
@@ -26,7 +26,7 @@ MixCommonArgs::MixCommonArgs(const string& programName)
       .shortName('j')
       .label("jobs")
       .description("maximum number of parallel builds")
-      .handler([=](std::string s) { settings.set("max-jobs", s); });
+      .handler([=](const std::string& s) { settings.set("max-jobs", s); });
 
   std::string cat = "config";
   globalConfig.convertToArgs(*this, cat);
diff --git a/third_party/nix/src/libmain/shared.cc b/third_party/nix/src/libmain/shared.cc
index 5c2084691144..f6c80cae30ef 100644
--- a/third_party/nix/src/libmain/shared.cc
+++ b/third_party/nix/src/libmain/shared.cc
@@ -36,7 +36,7 @@ void printGCWarning() {
   }
 }
 
-void printMissing(ref<Store> store, const PathSet& paths) {
+void printMissing(const ref<Store>& store, const PathSet& paths) {
   unsigned long long downloadSize;
   unsigned long long narSize;
   PathSet willBuild;
@@ -48,7 +48,7 @@ void printMissing(ref<Store> store, const PathSet& paths) {
                narSize);
 }
 
-void printMissing(ref<Store> store, const PathSet& willBuild,
+void printMissing(const ref<Store>& store, const PathSet& willBuild,
                   const PathSet& willSubstitute, const PathSet& unknown,
                   unsigned long long downloadSize, unsigned long long narSize) {
   if (!willBuild.empty()) {
@@ -260,14 +260,15 @@ void parseCmdLine(
     int argc, char** argv,
     std::function<bool(Strings::iterator& arg, const Strings::iterator& end)>
         parseArg) {
-  parseCmdLine(baseNameOf(argv[0]), argvToStrings(argc, argv), parseArg);
+  parseCmdLine(baseNameOf(argv[0]), argvToStrings(argc, argv),
+               std::move(parseArg));
 }
 
 void parseCmdLine(
     const string& programName, const Strings& args,
     std::function<bool(Strings::iterator& arg, const Strings::iterator& end)>
         parseArg) {
-  LegacyArgs(programName, parseArg).parseCmdline(args);
+  LegacyArgs(programName, std::move(parseArg)).parseCmdline(args);
 }
 
 void printVersion(const string& programName) {
@@ -298,7 +299,8 @@ void showManPage(const string& name) {
   throw SysError(format("command 'man %1%' failed") % name.c_str());
 }
 
-int handleExceptions(const string& programName, std::function<void()> fun) {
+int handleExceptions(const string& programName,
+                     const std::function<void()>& fun) {
   ReceiveInterrupts receiveInterrupts;  // FIXME: need better place for this
 
   string error = ANSI_RED "error:" ANSI_NORMAL " ";
diff --git a/third_party/nix/src/libmain/shared.hh b/third_party/nix/src/libmain/shared.hh
index db236a701778..da1c9cc66ac3 100644
--- a/third_party/nix/src/libmain/shared.hh
+++ b/third_party/nix/src/libmain/shared.hh
@@ -18,7 +18,8 @@ class Exit : public std::exception {
   virtual ~Exit();
 };
 
-int handleExceptions(const string& programName, std::function<void()> fun);
+int handleExceptions(const string& programName,
+                     const std::function<void()>& fun);
 
 /* Don't forget to call initPlugins() after settings are initialized! */
 void initNix();
@@ -40,9 +41,9 @@ void printGCWarning();
 
 class Store;
 
-void printMissing(ref<Store> store, const PathSet& paths);
+void printMissing(const ref<Store>& store, const PathSet& paths);
 
-void printMissing(ref<Store> store, const PathSet& willBuild,
+void printMissing(const ref<Store>& store, const PathSet& willBuild,
                   const PathSet& willSubstitute, const PathSet& unknown,
                   unsigned long long downloadSize, unsigned long long narSize);