diff --git a/include/fmt/std.h b/include/fmt/std.h index 544ec541..4b22eda1 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -125,7 +125,7 @@ struct formatter, Char, template auto format(std::optional const& opt, FormatContext& ctx) const -> decltype(ctx.out()) { - if (not opt) return detail::write(ctx.out(), none); + if (!opt) return detail::write(ctx.out(), none); auto out = ctx.out(); out = detail::write(out, optional); diff --git a/test/std-test.cc b/test/std-test.cc index a5a4dcc6..f30c514b 100644 --- a/test/std-test.cc +++ b/test/std-test.cc @@ -59,8 +59,7 @@ TEST(std_test, optional) { std::optional{3}}), "[optional(1), optional(2), optional(3)]"); EXPECT_EQ( - fmt::format("{}", std::optional>{std::optional{ - "nested"}}), + fmt::format("{}", std::optional>{{"nested"}}), "optional(optional(\"nested\"))"); EXPECT_EQ( fmt::format("{:<{}}", std::optional{std::string{"left aligned"}}, 30),