Annotate fmt::format and fmt::formatted_size as [[nodiscard]]
This prevents accidentally writing fmt::format when fmt::print was intended. Other than running tests, there's not a good use case for discarding the formatted output.
This commit is contained in:
committed by
Victor Zverovich
parent
5abe9e8266
commit
491ba2dda5
+2
-2
@@ -902,10 +902,10 @@ TEST(core_test, adl) {
|
||||
if (fmt::detail::const_check(true)) return;
|
||||
auto s = adl_test::string();
|
||||
char buf[10];
|
||||
fmt::format("{}", s);
|
||||
(void)fmt::format("{}", s);
|
||||
fmt::format_to(buf, "{}", s);
|
||||
fmt::format_to_n(buf, 10, "{}", s);
|
||||
fmt::formatted_size("{}", s);
|
||||
(void)fmt::formatted_size("{}", s);
|
||||
fmt::print("{}", s);
|
||||
fmt::print(stdout, "{}", s);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user