From edc4865eab6fdbd6e227c231866bfab83f15e87d Mon Sep 17 00:00:00 2001 From: Eric Cousineau Date: Mon, 15 Feb 2021 17:19:30 -0500 Subject: [PATCH] moar clang-tidy --- include/pybind11/pybind11.h | 2 +- include/pybind11/pytypes.h | 2 +- tests/test_ownership_transfer.cpp | 28 ++++++++++++++-------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 1536b1c7d7..63db280788 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1328,7 +1328,7 @@ template <> struct holder_check_impl : public holder_check_impl { template static bool check_destruct(detail::instance* inst, detail::holder_erased holder_raw) { - const holder_type& h = holder_raw.cast(); + const auto& h = holder_raw.cast(); handle src((PyObject*)inst); const detail::type_info *lowest_type = get_lowest_type(src, false); if (!lowest_type) diff --git a/include/pybind11/pytypes.h b/include/pybind11/pytypes.h index 147ad93325..2ce750da97 100644 --- a/include/pybind11/pytypes.h +++ b/include/pybind11/pytypes.h @@ -1638,7 +1638,7 @@ class wrapper : public Base { public: using Base::Base; - virtual ~wrapper() { + virtual ~wrapper() { // NOLINT(modernize-use-override) delete_py_if_in_cpp(); } diff --git a/tests/test_ownership_transfer.cpp b/tests/test_ownership_transfer.cpp index bedae4c8fb..49724e04eb 100644 --- a/tests/test_ownership_transfer.cpp +++ b/tests/test_ownership_transfer.cpp @@ -95,27 +95,27 @@ class DefinePyBaseWrapped : public py::wrapper> { }; // BaseBad - No wrapper alias. -typedef DefineBase BaseBad; -typedef DefineBaseContainer BaseBadContainer; -typedef Stats ChildBadStats; +using BaseBad = DefineBase; +using BaseBadContainer = DefineBaseContainer; +using ChildBadStats = Stats; // Base - wrapper alias used in pybind definition. -typedef DefineBase Base; -typedef DefinePyBase PyBase; -typedef DefineBaseContainer BaseContainer; -typedef Stats ChildStats; +using Base = DefineBase; +using PyBase = DefinePyBase; +using BaseContainer = DefineBaseContainer; +using ChildStats = Stats; // - Unique Ptr // BaseBad - No wrapper alias. -typedef DefineBase BaseBadUnique; -typedef DefineBaseUniqueContainer BaseBadUniqueContainer; -typedef Stats ChildBadUniqueStats; +using BaseBadUnique = DefineBase; +using BaseBadUniqueContainer = DefineBaseUniqueContainer; +using ChildBadUniqueStats = Stats; // Base - wrapper alias used directly. -typedef DefineBase BaseUnique; -typedef DefinePyBaseWrapped PyBaseUnique; -typedef DefineBaseUniqueContainer BaseUniqueContainer; -typedef Stats ChildUniqueStats; +using BaseUnique = DefineBase; +using PyBaseUnique = DefinePyBaseWrapped; +using BaseUniqueContainer = DefineBaseUniqueContainer; +using ChildUniqueStats = Stats; class PyInstanceStats { public: