diff --git a/.clang-tidy b/.clang-tidy index e82443c4c..ddee835c1 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -10,6 +10,7 @@ cppcoreguidelines-pro-type-static-cast-downcast, cppcoreguidelines-slicing, google-explicit-constructor, llvm-namespace-comment, +misc-definitions-in-headers, misc-misplaced-const, misc-non-copyable-objects, misc-static-assert, @@ -17,6 +18,7 @@ misc-throw-by-value-catch-by-reference, misc-uniqueptr-reset-release, misc-unused-parameters, modernize-avoid-bind, +modernize-loop-convert, modernize-make-shared, modernize-redundant-void-arg, modernize-replace-auto-ptr, @@ -63,6 +65,8 @@ readability-uniqueptr-delete-release, CheckOptions: - key: performance-for-range-copy.WarnOnAllAutoCopies value: true +- key: performance-inefficient-string-concatenation.StrictMode + value: true - key: performance-unnecessary-value-param.AllowedTypes value: 'exception_ptr$;' - key: readability-implicit-bool-conversion.AllowPointerConditions diff --git a/tests/test_constants_and_functions.cpp b/tests/test_constants_and_functions.cpp index 873fa1f55..1918a429c 100644 --- a/tests/test_constants_and_functions.cpp +++ b/tests/test_constants_and_functions.cpp @@ -31,8 +31,8 @@ py::bytes return_bytes() { std::string print_bytes(const py::bytes &bytes) { std::string ret = "bytes["; const auto value = static_cast(bytes); - for (size_t i = 0; i < value.length(); ++i) { - ret += std::to_string(static_cast(value[i])) + " "; + for (char c : value) { + ret += std::to_string(static_cast(c)) + ' '; } ret.back() = ']'; return ret;