Skip to content

Commit 2ada792

Browse files
committed
Pure clang-format cleanup (after #2904), NO other changes.
1 parent 784092d commit 2ada792

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

include/pybind11/detail/smart_holder_type_casters.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,8 @@ struct smart_holder_type_caster<std::unique_ptr<T, D>> : smart_holder_type_caste
716716

717717
return inst.release();
718718
}
719-
static handle cast(const std::unique_ptr<T, D> &src, return_value_policy policy, handle parent) {
719+
static handle
720+
cast(const std::unique_ptr<T, D> &src, return_value_policy policy, handle parent) {
720721
if (!src)
721722
return none().release();
722723
if (policy == return_value_policy::automatic)

tests/test_class_sh_basic.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ struct atyp { // Short for "any type".
1717
atyp(atyp &&other) { mtxt = other.mtxt + "_MvCtor"; }
1818
};
1919

20-
struct uconsumer { // unique_ptr consumer
20+
struct uconsumer { // unique_ptr consumer
2121
std::unique_ptr<atyp> held;
2222
bool valid() const { return static_cast<bool>(held); }
2323

2424
void pass_valu(std::unique_ptr<atyp> obj) { held = std::move(obj); }
2525
void pass_rref(std::unique_ptr<atyp> &&obj) { held = std::move(obj); }
2626
std::unique_ptr<atyp> rtrn_valu() { return std::move(held); }
27-
std::unique_ptr<atyp>& rtrn_lref() { return held; }
27+
std::unique_ptr<atyp> &rtrn_lref() { return held; }
2828
const std::unique_ptr<atyp> &rtrn_cref() { return held; }
2929
};
3030

@@ -71,7 +71,9 @@ std::string get_mtxt(atyp const &obj) { return obj.mtxt; }
7171
std::ptrdiff_t get_ptr(atyp const &obj) { return reinterpret_cast<std::ptrdiff_t>(&obj); }
7272

7373
std::unique_ptr<atyp> unique_ptr_roundtrip(std::unique_ptr<atyp> obj) { return obj; }
74-
const std::unique_ptr<atyp>& unique_ptr_cref_roundtrip(const std::unique_ptr<atyp>& obj) { return obj; }
74+
const std::unique_ptr<atyp> &unique_ptr_cref_roundtrip(const std::unique_ptr<atyp> &obj) {
75+
return obj;
76+
}
7577

7678
struct SharedPtrStash {
7779
std::vector<std::shared_ptr<const atyp>> stash;
@@ -139,8 +141,8 @@ TEST_SUBMODULE(class_sh_basic, m) {
139141

140142
// Helpers for testing.
141143
// These require selected functions above to work first, as indicated:
142-
m.def("get_mtxt", get_mtxt); // pass_cref
143-
m.def("get_ptr", get_ptr); // pass_cref
144+
m.def("get_mtxt", get_mtxt); // pass_cref
145+
m.def("get_ptr", get_ptr); // pass_cref
144146

145147
m.def("unique_ptr_roundtrip", unique_ptr_roundtrip); // pass_uqmp, rtrn_uqmp
146148
m.def("unique_ptr_cref_roundtrip", unique_ptr_cref_roundtrip);

0 commit comments

Comments
 (0)