From 5afd2c89dbfe00fa0181808e2bd2bd38cdb10f1d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 18:31:11 +0000 Subject: [PATCH] style: pre-commit fixes --- include/pybind11/attr.h | 9 ++++----- tests/test_custom_base.cpp | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/pybind11/attr.h b/include/pybind11/attr.h index aed6ba615..d6fc5405d 100644 --- a/include/pybind11/attr.h +++ b/include/pybind11/attr.h @@ -82,14 +82,14 @@ struct base { .. note:: This is an advanced feature. If you use this, you likely need to implement polymorphic_type_hook for your type hierarchy. \endrst */ -template struct custom_base { - using caster = void *(*)(void *); +template +struct custom_base { + using caster = void *(*) (void *); explicit custom_base(const caster &f) : fn(f) {} caster fn; }; - /// Keep patient alive while nurse lives template struct keep_alive {}; @@ -579,8 +579,7 @@ struct process_attribute> : process_attribute_default> { /// Process a custom base attribute template struct process_attribute> : process_attribute_default> { - static void init(const custom_base &b, type_record *r) - { + static void init(const custom_base &b, type_record *r) { r->add_base(typeid(T), b.fn); // TODO: rename this to 'nonsimple'? r->multiple_inheritance = true; diff --git a/tests/test_custom_base.cpp b/tests/test_custom_base.cpp index dc0ec1f63..411b11682 100644 --- a/tests/test_custom_base.cpp +++ b/tests/test_custom_base.cpp @@ -28,7 +28,8 @@ TEST_SUBMODULE(custom_base, m) { py::class_(m, "Derived", py::custom_base([](void *o) -> void * { return &reinterpret_cast(o)->base; - })).def_readwrite("j", &Derived::j); + })) + .def_readwrite("j", &Derived::j); m.def("create_derived", []() { return new Derived; }); m.def("create_base", []() { return new Base; }); @@ -36,4 +37,4 @@ TEST_SUBMODULE(custom_base, m) { m.def("base_i", [](Base *b) { return b->i; }); m.def("derived_j", [](Derived *d) { return d->j; }); -}; \ No newline at end of file +};