suppress warnings in tests for deprecated functions
[folly.git] / folly / detail / IPAddressSource.h
index 7f08f8440822ceeac3540f5d4ba57890cc6c8126..b81d854738ec967b07fc157e4be729b10a61cb9a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2014-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
 #include <string>
 #include <type_traits>
 
-#include <folly/Conv.h>
+#include <folly/Format.h>
 #include <folly/detail/IPAddress.h>
 
 // BSDish platforms don't provide standard access to s6_addr16
@@ -74,11 +74,9 @@ struct Bytes {
         0xff // /8
     }};
     if (oneMask > kBitCount || twoMask > kBitCount) {
-      throw std::invalid_argument(folly::to<std::string>(
-          "Invalid mask "
-          "length: ",
-          oneMask > twoMask ? oneMask : twoMask,
-          ". Mask length must be <= ",
+      throw std::invalid_argument(sformat(
+          "Invalid mask length: {}. Mask length must be <= {}",
+          std::max(oneMask, twoMask),
           kBitCount));
     }
 
@@ -275,5 +273,5 @@ inline void fastIpv6AppendToString(const in6_addr& in6Addr, std::string& out) {
   char str[sizeof("2001:0db8:0000:0000:0000:ff00:0042:8329")];
   out.append(str, fastIpv6ToBufferUnsafe(in6Addr, str));
 }
-}
-}
+} // namespace detail
+} // namespace folly