Skip to content

Commit b486544

Browse files
committed
Fix clang-tidy complaints
1 parent ba9883c commit b486544

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/test_stl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ class ReferenceSensitiveOptional {
120120
using value_type = T;
121121

122122
ReferenceSensitiveOptional() = default;
123+
// NOLINTNEXTLINE(google-explicit-constructor)
123124
ReferenceSensitiveOptional(const T& value) : storage{value} {}
125+
// NOLINTNEXTLINE(google-explicit-constructor)
124126
ReferenceSensitiveOptional(T&& value) : storage{std::move(value)} {}
125127
ReferenceSensitiveOptional& operator=(const T& value) {
126128
storage = {value};
@@ -162,7 +164,8 @@ class ReferenceSensitiveOptional {
162164
namespace pybind11 { namespace detail {
163165
template <typename T>
164166
struct type_caster<ReferenceSensitiveOptional<T>> : optional_caster<ReferenceSensitiveOptional<T>> {};
165-
}} // namespace pybind11::detail
167+
} // namespace pybind11::detail
168+
} // namespace pybind11
166169

167170

168171
TEST_SUBMODULE(stl, m) {
@@ -365,7 +368,7 @@ TEST_SUBMODULE(stl, m) {
365368
return x.value_or(0) * 2;
366369
});
367370
m.def("half_or_none_boost", [](int x) -> boost_opt_int {
368-
return x ? boost_opt_int(x / 2) : boost_opt_int();
371+
return x != 0 ? boost_opt_int(x / 2) : boost_opt_int();
369372
});
370373
m.def("test_nullopt_boost", [](boost_opt_int x) {
371374
return x.value_or(42);

0 commit comments

Comments
 (0)