about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/names.cc9
-rw-r--r--src/nix-env/nix-env.cc12
2 files changed, 8 insertions, 13 deletions
diff --git a/src/libexpr/names.cc b/src/libexpr/names.cc
index 29c7ddb4d70f..781c2b6468f9 100644
--- a/src/libexpr/names.cc
+++ b/src/libexpr/names.cc
@@ -55,7 +55,7 @@ static string nextComponent(string::const_iterator & p,
     else
         while (p != end && (!isdigit(*p) && *p != '.' && *p != '-'))
             s += *p++;
-    
+
     return s;
 }
 
@@ -80,7 +80,7 @@ int compareVersions(const string & v1, const string & v2)
 {
     string::const_iterator p1 = v1.begin();
     string::const_iterator p2 = v2.begin();
-    
+
     while (p1 != v1.end() || p2 != v2.end()) {
         string c1 = nextComponent(p1, v1.end());
         string c2 = nextComponent(p2, v2.end());
@@ -95,11 +95,10 @@ int compareVersions(const string & v1, const string & v2)
 DrvNames drvNamesFromArgs(const Strings & opArgs)
 {
     DrvNames result;
-    for (Strings::const_iterator i = opArgs.begin();
-         i != opArgs.end(); ++i)
+    foreach (Strings::const_iterator, i, opArgs)
         result.push_back(DrvName(*i));
     return result;
 }
 
- 
+
 }
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 9f51e919b0e9..2a66743eebca 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -243,13 +243,13 @@ static DrvInfos filterBySelector(EvalState & state, const DrvInfos & allElems,
     const Strings & args, bool newestOnly)
 {
     DrvNames selectors = drvNamesFromArgs(args);
+    if (selectors.empty())
+        selectors.push_back(DrvName("*"));
 
     DrvInfos elems;
     set<unsigned int> done;
 
-    for (DrvNames::iterator i = selectors.begin();
-         i != selectors.end(); ++i)
-    {
+    foreach (DrvNames::iterator, i, selectors) {
         typedef list<std::pair<DrvInfo, unsigned int> > Matches;
         Matches matches;
         unsigned int n = 0;
@@ -321,8 +321,7 @@ static DrvInfos filterBySelector(EvalState & state, const DrvInfos & allElems,
     }
 
     /* Check that all selectors have been used. */
-    for (DrvNames::iterator i = selectors.begin();
-         i != selectors.end(); ++i)
+    foreach (DrvNames::iterator, i, selectors)
         if (i->hits == 0 && i->fullName != "*")
             throw Error(format("selector `%1%' matches no derivations")
                 % i->fullName);
@@ -913,9 +912,6 @@ static void opQuery(Globals & globals,
         else remaining.push_back(arg);
     }
 
-    if (remaining.size() == 0)
-        printMsg(lvlInfo, "warning: you probably meant to specify the argument '*' to show all packages");
-
 
     /* Obtain derivation information from the specified source. */
     DrvInfos availElems, installedElems;