From 28b082cc2bb0b1d1b384264e0fdeb248e890ef22 Mon Sep 17 00:00:00 2001 From: ssszcmawo Date: Thu, 5 Feb 2026 03:47:47 +0100 Subject: [PATCH] Cleanup documentation (#4667) * Cleanup documentation * Fix comment typo in fmt::formatter struct * Fix formatting and grammar in api.md Corrected formatting and grammar in the API documentation. --- doc/api.md | 10 +++++----- include/fmt/printf.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/api.md b/doc/api.md index dc544e7b..a95716ee 100644 --- a/doc/api.md +++ b/doc/api.md @@ -28,7 +28,7 @@ dependencies for better compile times. This header is only beneficial when using {fmt} as a library (the default) and not in the header-only mode. It also provides `formatter` specializations for the following types: -- `int`, `long long`, +- `int`, `long long` - `unsigned`, `unsigned long long` - `float`, `double`, `long double` - `bool` @@ -105,8 +105,8 @@ Example ([run](https://godbolt.org/z/nvME4arz8)): fmt::print("{}\n", kevin_namespacy::film::se7en); // Output: 7 } -Using specialization is more complex but gives you full control over -parsing and formatting. To use this method specialize the `formatter` +Using a specialization is more complex, but gives you full control over +parsing and formatting. To use this method, specialize the `formatter` struct template for your type and implement `parse` and `format` methods. @@ -515,7 +515,7 @@ chrono-format-specifications). ### Variants -A `std::variant` is only formattable if every variant alternative is +A `std::variant` can be formatted only if every alternative is formattable, and requires the `__cpp_lib_variant` [library feature](https://en.cppreference.com/w/cpp/feature_test). @@ -719,7 +719,7 @@ configuring CMake. ### CMake Options - **`FMT_OS`**: When set to `OFF`, disables OS-specific APIs (`fmt/os.h`). -- **`FMT_UNICODE`**: When set of `OFF`, disables Unicode support on +- **`FMT_UNICODE`**: When set to `OFF`, disables Unicode support on Windows/MSVC. Unicode support is always enabled on other platforms. ### Macros diff --git a/include/fmt/printf.h b/include/fmt/printf.h index e4fa4967..7f6f6f3a 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -473,7 +473,7 @@ void vprintf(buffer& buf, basic_string_view format, } auto arg = get_arg(arg_index); - // For d, i, o, u, x, and X conversion specifiers, if a precision is + // For d, i, o, u, x and X conversion specifiers, if a precision is // specified, the '0' flag is ignored if (specs.precision >= 0 && is_integral_type(arg.type())) { // Ignore '0' for non-numeric types or if '-' present. @@ -586,7 +586,7 @@ inline auto vsprintf(basic_string_view fmt, /** * Formats `args` according to specifications in `fmt` and returns the result - * as as string. + * as string. * * **Example**: *