NOLINT reduction (#3096)

* Copying from prework_no_rst branch (PR #3087): test_numpy_array.cpp, test_stl.cpp

* Manual changes reducing NOLINTs.

* clang-format-diff.py

* Minor adjustment to avoid MSVC warning C4702: unreachable code
This commit is contained in:
Ralf W. Grosse-Kunstleve
2021-07-12 13:10:28 -07:00
committed by GitHub
parent 7a64b8adcc
commit 2d468697d9
14 changed files with 138 additions and 203 deletions
+10 -14
View File
@@ -40,13 +40,13 @@ TEST_SUBMODULE(numpy_vectorize, m) {
// test_type_selection
// NumPy function which only accepts specific data types
// A lot of these no lints could be replaced with const refs, and probably should at some point.
// NOLINTNEXTLINE(performance-unnecessary-value-param)
m.def("selective_func", [](py::array_t<int, py::array::c_style>) { return "Int branch taken."; });
// NOLINTNEXTLINE(performance-unnecessary-value-param)
m.def("selective_func", [](py::array_t<float, py::array::c_style>) { return "Float branch taken."; });
// NOLINTNEXTLINE(performance-unnecessary-value-param)
m.def("selective_func", [](py::array_t<std::complex<float>, py::array::c_style>) { return "Complex float branch taken."; });
m.def("selective_func",
[](const py::array_t<int, py::array::c_style> &) { return "Int branch taken."; });
m.def("selective_func",
[](const py::array_t<float, py::array::c_style> &) { return "Float branch taken."; });
m.def("selective_func", [](const py::array_t<std::complex<float>, py::array::c_style> &) {
return "Complex float branch taken.";
});
// test_passthrough_arguments
// Passthrough test: references and non-pod types should be automatically passed through (in the
@@ -89,13 +89,9 @@ TEST_SUBMODULE(numpy_vectorize, m) {
.value("c_trivial", py::detail::broadcast_trivial::c_trivial)
.value("non_trivial", py::detail::broadcast_trivial::non_trivial);
m.def("vectorized_is_trivial",
[](
// NOLINTNEXTLINE(performance-unnecessary-value-param)
py::array_t<int, py::array::forcecast> arg1,
// NOLINTNEXTLINE(performance-unnecessary-value-param)
py::array_t<float, py::array::forcecast> arg2,
// NOLINTNEXTLINE(performance-unnecessary-value-param)
py::array_t<double, py::array::forcecast> arg3) {
[](const py::array_t<int, py::array::forcecast> &arg1,
const py::array_t<float, py::array::forcecast> &arg2,
const py::array_t<double, py::array::forcecast> &arg3) {
py::ssize_t ndim;
std::vector<py::ssize_t> shape;
std::array<py::buffer_info, 3> buffers{