CodeHealth: Enabling clang-tidy google-explicit-constructor (#3250)

* Adding google-explicit-constructor to .clang-tidy

* clang-tidy explicit attr.h (all automatic)

* clang-tidy explicit cast.h (all automatic)

* clang-tidy detail/init.h (1 NOLINT)

* clang-tidy detail/type_caster_base.h (2 NOLINT)

* clang-tidy pybind11.h (7 NOLINT)

* clang-tidy detail/common.h (3 NOLINT)

* clang-tidy detail/descr.h (2 NOLINT)

* clang-tidy pytypes.h (23 NOLINT, only 1 explicit)

* clang-tidy eigen.h (7 NOLINT, 0 explicit)

* Adding 2 explicit in functional.h

* Adding 4 explicit in iostream.h

* clang-tidy numpy.h (1 NOLINT, 1 explicit)

* clang-tidy embed.h (0 NOLINT, 1 explicit)

* clang-tidy tests/local_bindings.h (0 NOLINT, 4 explicit)

* clang-tidy tests/pybind11_cross_module_tests.cpp (0 NOLINT, 1 explicit)

* clang-tidy tests/pybind11_tests.h (0 NOLINT, 2 explicit)

* clang-tidy tests/test_buffers.cpp (0 NOLINT, 2 explicit)

* clang-tidy tests/test_builtin_casters.cpp (0 NOLINT, 4 explicit)

* clang-tidy tests/test_class.cpp (0 NOLINT, 6 explicit)

* clang-tidy tests/test_copy_move.cpp (0 NOLINT, 7 explicit)

* clang-tidy tests/test_embed/external_module.cpp (0 NOLINT, 1 explicit)

* clang-tidy tests/test_embed/test_interpreter.cpp (0 NOLINT, 1 explicit)

* clang-tidy tests/object.h (0 NOLINT, 2 explicit)

* clang-tidy batch of fully automatic fixes.

* Workaround for MSVC 19.16.27045.0 C++17 Python 2 C++ syntax error.
This commit is contained in:
Ralf W. Grosse-Kunstleve
2021-09-08 18:53:38 -07:00
committed by GitHub
parent 39a0aac88e
commit 6abf2baa62
38 changed files with 231 additions and 132 deletions

View File

@@ -16,7 +16,7 @@ namespace {
// Many bases for testing that multiple inheritance from many classes (i.e. requiring extra
// space for holder constructed flags) works.
template <int N> struct BaseN {
BaseN(int i) : i(i) { }
explicit BaseN(int i) : i(i) {}
int i;
};
@@ -47,12 +47,12 @@ int VanillaStaticMix2::static_value = 12;
// test_multiple_inheritance_virtbase
struct Base1a {
Base1a(int i) : i(i) { }
explicit Base1a(int i) : i(i) {}
int foo() const { return i; }
int i;
};
struct Base2a {
Base2a(int i) : i(i) { }
explicit Base2a(int i) : i(i) {}
int bar() const { return i; }
int i;
};
@@ -77,7 +77,7 @@ TEST_SUBMODULE(multiple_inheritance, m) {
// test_multiple_inheritance_mix1
// test_multiple_inheritance_mix2
struct Base1 {
Base1(int i) : i(i) { }
explicit Base1(int i) : i(i) {}
int foo() const { return i; }
int i;
};
@@ -86,7 +86,7 @@ TEST_SUBMODULE(multiple_inheritance, m) {
.def("foo", &Base1::foo);
struct Base2 {
Base2(int i) : i(i) { }
explicit Base2(int i) : i(i) {}
int bar() const { return i; }
int i;
};