@@ -226,8 +226,7 @@ TEST_SUBMODULE(numpy_array, sm) {
226226 return py::isinstance<py::array>(std::move (yes))
227227 && !py::isinstance<py::array>(std::move (no));
228228 });
229- // NOLINTNEXTLINE(performance-unnecessary-value-param)
230- sm.def (" isinstance_typed" , [](py::object o) {
229+ sm.def (" isinstance_typed" , [](const py::object &o) {
231230 return py::isinstance<py::array_t <double >>(o) && !py::isinstance<py::array_t <int >>(o);
232231 });
233232
@@ -248,60 +247,47 @@ TEST_SUBMODULE(numpy_array, sm) {
248247 });
249248
250249 // test_overload_resolution
251- // NOLINTNEXTLINE(performance-unnecessary-value-param)
252- sm.def (" overloaded" , [](py::array_t <double >) { return " double" ; });
253- // NOLINTNEXTLINE(performance-unnecessary-value-param)
254- sm.def (" overloaded" , [](py::array_t <float >) { return " float" ; });
255- // NOLINTNEXTLINE(performance-unnecessary-value-param)
256- sm.def (" overloaded" , [](py::array_t <int >) { return " int" ; });
257- // NOLINTNEXTLINE(performance-unnecessary-value-param)
258- sm.def (" overloaded" , [](py::array_t <unsigned short >) { return " unsigned short" ; });
259- // NOLINTNEXTLINE(performance-unnecessary-value-param)
260- sm.def (" overloaded" , [](py::array_t <long long >) { return " long long" ; });
261- // NOLINTNEXTLINE(performance-unnecessary-value-param)
262- sm.def (" overloaded" , [](py::array_t <std::complex <double >>) { return " double complex" ; });
263- // NOLINTNEXTLINE(performance-unnecessary-value-param)
264- sm.def (" overloaded" , [](py::array_t <std::complex <float >>) { return " float complex" ; });
265-
266- // NOLINTNEXTLINE(performance-unnecessary-value-param)
267- sm.def (" overloaded2" , [](py::array_t <std::complex <double >>) { return " double complex" ; });
268- // NOLINTNEXTLINE(performance-unnecessary-value-param)
269- sm.def (" overloaded2" , [](py::array_t <double >) { return " double" ; });
270- // NOLINTNEXTLINE(performance-unnecessary-value-param)
271- sm.def (" overloaded2" , [](py::array_t <std::complex <float >>) { return " float complex" ; });
272- // NOLINTNEXTLINE(performance-unnecessary-value-param)
273- sm.def (" overloaded2" , [](py::array_t <float >) { return " float" ; });
250+ sm.def (" overloaded" , [](const py::array_t <double > &) { return " double" ; });
251+ sm.def (" overloaded" , [](const py::array_t <float > &) { return " float" ; });
252+ sm.def (" overloaded" , [](const py::array_t <int > &) { return " int" ; });
253+ sm.def (" overloaded" , [](const py::array_t <unsigned short > &) { return " unsigned short" ; });
254+ sm.def (" overloaded" , [](const py::array_t <long long > &) { return " long long" ; });
255+ sm.def (" overloaded" ,
256+ [](const py::array_t <std::complex <double >> &) { return " double complex" ; });
257+ sm.def (" overloaded" , [](const py::array_t <std::complex <float >> &) { return " float complex" ; });
258+
259+ sm.def (" overloaded2" ,
260+ [](const py::array_t <std::complex <double >> &) { return " double complex" ; });
261+ sm.def (" overloaded2" , [](const py::array_t <double > &) { return " double" ; });
262+ sm.def (" overloaded2" ,
263+ [](const py::array_t <std::complex <float >> &) { return " float complex" ; });
264+ sm.def (" overloaded2" , [](const py::array_t <float > &) { return " float" ; });
274265
275266 // [workaround(intel)] ICC 20/21 breaks with py::arg().stuff, using py::arg{}.stuff works.
276267
277268 // Only accept the exact types:
278- // NOLINTNEXTLINE(performance-unnecessary-value-param)
279- sm.def (" overloaded3" , [](py::array_t <int >) { return " int" ; }, py::arg{}.noconvert ());
280- // NOLINTNEXTLINE(performance-unnecessary-value-param)
281- sm.def (" overloaded3" , [](py::array_t <double >) { return " double" ; }, py::arg{}.noconvert ());
269+ sm.def (
270+ " overloaded3" , [](const py::array_t <int > &) { return " int" ; }, py::arg{}.noconvert ());
271+ sm.def (
272+ " overloaded3" ,
273+ [](const py::array_t <double > &) { return " double" ; },
274+ py::arg{}.noconvert ());
282275
283276 // Make sure we don't do unsafe coercion (e.g. float to int) when not using forcecast, but
284277 // rather that float gets converted via the safe (conversion to double) overload:
285- // NOLINTNEXTLINE(performance-unnecessary-value-param)
286- sm.def (" overloaded4" , [](py::array_t <long long , 0 >) { return " long long" ; });
287- // NOLINTNEXTLINE(performance-unnecessary-value-param)
288- sm.def (" overloaded4" , [](py::array_t <double , 0 >) { return " double" ; });
278+ sm.def (" overloaded4" , [](const py::array_t <long long , 0 > &) { return " long long" ; });
279+ sm.def (" overloaded4" , [](const py::array_t <double , 0 > &) { return " double" ; });
289280
290281 // But we do allow conversion to int if forcecast is enabled (but only if no overload matches
291282 // without conversion)
292- // NOLINTNEXTLINE(performance-unnecessary-value-param)
293- sm.def (" overloaded5" , [](py::array_t <unsigned int >) { return " unsigned int" ; });
294- // NOLINTNEXTLINE(performance-unnecessary-value-param)
295- sm.def (" overloaded5" , [](py::array_t <double >) { return " double" ; });
283+ sm.def (" overloaded5" , [](const py::array_t <unsigned int > &) { return " unsigned int" ; });
284+ sm.def (" overloaded5" , [](const py::array_t <double > &) { return " double" ; });
296285
297286 // test_greedy_string_overload
298287 // Issue 685: ndarray shouldn't go to std::string overload
299- // NOLINTNEXTLINE(performance-unnecessary-value-param)
300- sm.def (" issue685" , [](std::string) { return " string" ; });
301- // NOLINTNEXTLINE(performance-unnecessary-value-param)
302- sm.def (" issue685" , [](py::array) { return " array" ; });
303- // NOLINTNEXTLINE(performance-unnecessary-value-param)
304- sm.def (" issue685" , [](py::object) { return " other" ; });
288+ sm.def (" issue685" , [](const std::string &) { return " string" ; });
289+ sm.def (" issue685" , [](const py::array &) { return " array" ; });
290+ sm.def (" issue685" , [](const py::object &) { return " other" ; });
305291
306292 // test_array_unchecked_fixed_dims
307293 sm.def (" proxy_add2" , [](py::array_t <double > a, double v) {
@@ -424,73 +410,53 @@ TEST_SUBMODULE(numpy_array, sm) {
424410
425411 // test_argument_conversions
426412 sm.def (
427- " accept_double" ,
428- // NOLINTNEXTLINE(performance-unnecessary-value-param)
429- [](py::array_t <double , 0 >) {},
430- py::arg (" a" ));
413+ " accept_double" , [](const py::array_t <double , 0 > &) {}, py::arg (" a" ));
431414 sm.def (
432415 " accept_double_forcecast" ,
433- // NOLINTNEXTLINE(performance-unnecessary-value-param)
434- [](py::array_t <double , py::array::forcecast>) {},
416+ [](const py::array_t <double , py::array::forcecast> &) {},
435417 py::arg (" a" ));
436418 sm.def (
437419 " accept_double_c_style" ,
438- // NOLINTNEXTLINE(performance-unnecessary-value-param)
439- [](py::array_t <double , py::array::c_style>) {},
420+ [](const py::array_t <double , py::array::c_style> &) {},
440421 py::arg (" a" ));
441422 sm.def (
442423 " accept_double_c_style_forcecast" ,
443- // NOLINTNEXTLINE(performance-unnecessary-value-param)
444- [](py::array_t <double , py::array::forcecast | py::array::c_style>) {},
424+ [](const py::array_t <double , py::array::forcecast | py::array::c_style> &) {},
445425 py::arg (" a" ));
446426 sm.def (
447427 " accept_double_f_style" ,
448- // NOLINTNEXTLINE(performance-unnecessary-value-param)
449- [](py::array_t <double , py::array::f_style>) {},
428+ [](const py::array_t <double , py::array::f_style> &) {},
450429 py::arg (" a" ));
451430 sm.def (
452431 " accept_double_f_style_forcecast" ,
453- // NOLINTNEXTLINE(performance-unnecessary-value-param)
454- [](py::array_t <double , py::array::forcecast | py::array::f_style>) {},
432+ [](const py::array_t <double , py::array::forcecast | py::array::f_style> &) {},
455433 py::arg (" a" ));
456434 sm.def (
457- " accept_double_noconvert" ,
458- // NOLINTNEXTLINE(performance-unnecessary-value-param)
459- [](py::array_t <double , 0 >) {},
460- " a" _a.noconvert ());
435+ " accept_double_noconvert" , [](const py::array_t <double , 0 > &) {}, " a" _a.noconvert ());
461436 sm.def (
462437 " accept_double_forcecast_noconvert" ,
463- // NOLINTNEXTLINE(performance-unnecessary-value-param)
464- [](py::array_t <double , py::array::forcecast>) {},
438+ [](const py::array_t <double , py::array::forcecast> &) {},
465439 " a" _a.noconvert ());
466440 sm.def (
467441 " accept_double_c_style_noconvert" ,
468- // NOLINTNEXTLINE(performance-unnecessary-value-param)
469- [](py::array_t <double , py::array::c_style>) {},
442+ [](const py::array_t <double , py::array::c_style> &) {},
470443 " a" _a.noconvert ());
471444 sm.def (
472445 " accept_double_c_style_forcecast_noconvert" ,
473- // NOLINTNEXTLINE(performance-unnecessary-value-param)
474- [](py::array_t <double , py::array::forcecast | py::array::c_style>) {},
446+ [](const py::array_t <double , py::array::forcecast | py::array::c_style> &) {},
475447 " a" _a.noconvert ());
476448 sm.def (
477449 " accept_double_f_style_noconvert" ,
478- // NOLINTNEXTLINE(performance-unnecessary-value-param)
479- [](py::array_t <double , py::array::f_style>) {},
450+ [](const py::array_t <double , py::array::f_style> &) {},
480451 " a" _a.noconvert ());
481452 sm.def (
482453 " accept_double_f_style_forcecast_noconvert" ,
483- // NOLINTNEXTLINE(performance-unnecessary-value-param)
484- [](py::array_t <double , py::array::forcecast | py::array::f_style>) {},
454+ [](const py::array_t <double , py::array::forcecast | py::array::f_style> &) {},
485455 " a" _a.noconvert ());
486456
487457 // Check that types returns correct npy format descriptor
488- // NOLINTNEXTLINE(performance-unnecessary-value-param)
489- sm.def (" test_fmt_desc_float" , [](py::array_t <float >) {});
490- // NOLINTNEXTLINE(performance-unnecessary-value-param)
491- sm.def (" test_fmt_desc_double" , [](py::array_t <double >) {});
492- // NOLINTNEXTLINE(performance-unnecessary-value-param)
493- sm.def (" test_fmt_desc_const_float" , [](py::array_t <const float >) {});
494- // NOLINTNEXTLINE(performance-unnecessary-value-param)
495- sm.def (" test_fmt_desc_const_double" , [](py::array_t <const double >) {});
458+ sm.def (" test_fmt_desc_float" , [](const py::array_t <float > &) {});
459+ sm.def (" test_fmt_desc_double" , [](const py::array_t <double > &) {});
460+ sm.def (" test_fmt_desc_const_float" , [](const py::array_t <const float > &) {});
461+ sm.def (" test_fmt_desc_const_double" , [](const py::array_t <const double > &) {});
496462}
0 commit comments