diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx
index 2c3e21f79..1dbbd0cf3 100644
--- a/src/protocol/ArgParser.cxx
+++ b/src/protocol/ArgParser.cxx
@@ -22,8 +22,6 @@
 #include "Result.hxx"
 #include "Chrono.hxx"
 
-#include <limits>
-
 #include <stdlib.h>
 
 bool
diff --git a/src/protocol/ArgParser.hxx b/src/protocol/ArgParser.hxx
index d71894771..221ffebe3 100644
--- a/src/protocol/ArgParser.hxx
+++ b/src/protocol/ArgParser.hxx
@@ -22,6 +22,8 @@
 
 #include "check.h"
 
+#include <limits>
+
 #include <stdint.h>
 
 class Client;
@@ -39,7 +41,7 @@ struct RangeArg {
 
 	void SetAll() {
 		start = 0;
-		end = unsigned(-1);
+		end = std::numeric_limits<unsigned>::max();
 	}
 };