Fix clang-tidy findings in documentation examples and replace redundant aliases

Apply clang-tidy fixes to the documentation examples:
- performance-avoid-endl: std::endl -> '\n'
- readability-qualified-auto: auto -> auto* / const auto*
- performance-for-range-copy: copy -> const reference
- google-readability-casting: C-style cast -> static_cast

Replace redundant aliases (readability-redundant-qualified-alias) such as
"using json = nlohmann::json;" with "using nlohmann::json;" in the
documentation, README, examples, tests, and benchmarks. Aliases at class
scope and aliases of other types (with_base_class_t etc.) are kept.

No changes to the library or its public API. All changed examples were
compiled and run; their output matches the stored .output files (except
max_size and meta, which depend on the platform and compiler).

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-25 08:17:41 +01:00
1 parent d99cacf4a8
commit d93ea68633
366 files changed
+592 -592

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@
#include <vector>
#include <test_data.hpp>
using json = nlohmann::json;
using nlohmann::json;
//////////////////////////////////////////////////////////////////////////////
// parse JSON from file
+2 -2
View File
@@ -17,8 +17,8 @@
#include <string>
#include <test_data.hpp>
using json = nlohmann::json;
using json_document = nlohmann::json_document;
using nlohmann::json;
using nlohmann::json_document;
static std::string read_file(const char* filename)
{