diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h index a4154136a..5b2ec8e1e 100644 --- a/include/pybind11/detail/type_caster_base.h +++ b/include/pybind11/detail/type_caster_base.h @@ -225,8 +225,8 @@ PYBIND11_NOINLINE detail::type_info *get_type_info(const std::type_index &tp, if (throw_if_missing) { std::string tname = tp.name(); detail::clean_type_id(tname); - pybind11_fail("pybind11::detail::get_type_info: unable to find type info for \"" + tname - + "\""); + pybind11_fail("pybind11::detail::get_type_info: unable to find type info for \"" + + std::move(tname) + '"'); } return nullptr; } @@ -512,9 +512,13 @@ PYBIND11_NOINLINE std::string error_string() { Py_INCREF(f_code); # endif int lineno = PyFrame_GetLineNumber(frame); - errorString += " " + handle(f_code->co_filename).cast() + "(" - + std::to_string(lineno) - + "): " + handle(f_code->co_name).cast() + "\n"; + errorString += " "; + errorString += handle(f_code->co_filename).cast(); + errorString += '('; + errorString += std::to_string(lineno); + errorString += "): "; + errorString += handle(f_code->co_name).cast(); + errorString += '\n'; Py_DECREF(f_code); # if PY_VERSION_HEX >= 0x030900B1 auto *b_frame = PyFrame_GetBack(frame); diff --git a/include/pybind11/eigen.h b/include/pybind11/eigen.h index 930c4f7fa..f658168de 100644 --- a/include/pybind11/eigen.h +++ b/include/pybind11/eigen.h @@ -668,7 +668,7 @@ struct type_caster::value>> { Type::Flags &(Eigen::RowMajor | Eigen::ColMajor), StorageIndex>(shape[0].cast(), shape[1].cast(), - nnz, + std::move(nnz), outerIndices.mutable_data(), innerIndices.mutable_data(), values.mutable_data()); @@ -686,7 +686,8 @@ struct type_caster::value>> { array outerIndices((rowMajor ? src.rows() : src.cols()) + 1, src.outerIndexPtr()); array innerIndices(src.nonZeros(), src.innerIndexPtr()); - return matrix_type(std::make_tuple(data, innerIndices, outerIndices), + return matrix_type(std::make_tuple( + std::move(data), std::move(innerIndices), std::move(outerIndices)), std::make_pair(src.rows(), src.cols())) .release(); } diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 5e68f6053..07dea21b4 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -940,7 +940,7 @@ protected: void fail_dim_check(ssize_t dim, const std::string &msg) const { throw index_error(msg + ": " + std::to_string(dim) + " (ndim = " + std::to_string(ndim()) - + ")"); + + ')'); } template @@ -1144,11 +1144,11 @@ struct format_descriptor::value> template struct format_descriptor { - static std::string format() { return std::to_string(N) + "s"; } + static std::string format() { return std::to_string(N) + 's'; } }; template struct format_descriptor> { - static std::string format() { return std::to_string(N) + "s"; } + static std::string format() { return std::to_string(N) + 's'; } }; template diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 422d534c1..fa018b509 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -561,14 +561,14 @@ protected: for (auto *it = chain_start; it != nullptr; it = it->next) { if (options::show_function_signatures()) { if (index > 0) { - signatures += "\n"; + signatures += '\n'; } if (chain) { signatures += std::to_string(++index) + ". "; } signatures += rec->name; signatures += it->signature; - signatures += "\n"; + signatures += '\n'; } if (it->doc && it->doc[0] != '\0' && options::show_user_defined_docstrings()) { // If we're appending another docstring, and aren't printing function signatures, @@ -577,15 +577,15 @@ protected: if (first_user_def) { first_user_def = false; } else { - signatures += "\n"; + signatures += '\n'; } } if (options::show_function_signatures()) { - signatures += "\n"; + signatures += '\n'; } signatures += it->doc; if (options::show_function_signatures()) { - signatures += "\n"; + signatures += '\n'; } } } @@ -1055,7 +1055,7 @@ protected: msg += it2->signature; } - msg += "\n"; + msg += '\n'; } msg += "\nInvoked with: "; auto args_ = reinterpret_borrow(args_in);