diff --git a/eden/fs/config/FieldConverter.h b/eden/fs/config/FieldConverter.h index 08a4cb84cf..b04a96efbf 100644 --- a/eden/fs/config/FieldConverter.h +++ b/eden/fs/config/FieldConverter.h @@ -61,13 +61,11 @@ class FieldConverter { /* * FieldConverter implementation for integers, floating point, and bool types - * using folly::to(string) */ template class FieldConverter< T, - typename std::enable_if< - std::is_arithmetic::value || std::is_same::value>::type> { + typename std::enable_if::value>::type> { public: /** * Convert the passed string piece to a boolean. @@ -87,6 +85,9 @@ class FieldConverter< } std::string toDebugString(T value) const { + if constexpr (std::is_same::value) { + return value ? "true" : "false"; + } return folly::to(value); } }; diff --git a/eden/fs/config/test/ConfigSettingTest.cpp b/eden/fs/config/test/ConfigSettingTest.cpp index eb7c3e033f..93c314cb68 100644 --- a/eden/fs/config/test/ConfigSettingTest.cpp +++ b/eden/fs/config/test/ConfigSettingTest.cpp @@ -321,12 +321,12 @@ TEST(ConfigSettingTest, setBool) { checkSet(setting, true, "yes"); checkSet(setting, true, "Y"); checkSet(setting, true, "on"); - EXPECT_EQ("1", setting.getStringValue()); + EXPECT_EQ("true", setting.getStringValue()); checkSet(setting, false, "n"); checkSet(setting, false, "0"); checkSet(setting, false, "false"); checkSet(setting, false, "off"); - EXPECT_EQ("0", setting.getStringValue()); + EXPECT_EQ("false", setting.getStringValue()); checkSetError(setting, "Empty input string", ""); checkSetError(setting, "Invalid value for bool: \"bogus\"", "bogus");