From 2ae28fc8525813023f8ec0f5318670cfaf86ec83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Fri, 28 May 2021 23:43:15 +0200 Subject: [PATCH] Use make_unique instead of unique_ptr(new T) in more places --- src/catch2/internal/catch_test_registry.cpp | 2 +- src/catch2/internal/catch_test_registry.hpp | 2 +- src/catch2/reporters/catch_reporter_console.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/catch2/internal/catch_test_registry.cpp b/src/catch2/internal/catch_test_registry.cpp index bb5d7810..e4ebc2dd 100644 --- a/src/catch2/internal/catch_test_registry.cpp +++ b/src/catch2/internal/catch_test_registry.cpp @@ -14,7 +14,7 @@ namespace Catch { Detail::unique_ptr makeTestInvoker( void(*testAsFunction)() ) { - return Detail::unique_ptr( new TestInvokerAsFunction( testAsFunction )); + return Detail::make_unique( testAsFunction ); } AutoReg::AutoReg( Detail::unique_ptr invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept { diff --git a/src/catch2/internal/catch_test_registry.hpp b/src/catch2/internal/catch_test_registry.hpp index 3c6ce957..c7e110f0 100644 --- a/src/catch2/internal/catch_test_registry.hpp +++ b/src/catch2/internal/catch_test_registry.hpp @@ -42,7 +42,7 @@ Detail::unique_ptr makeTestInvoker( void(*testAsFunction)() ); template Detail::unique_ptr makeTestInvoker( void (C::*testAsMethod)() ) { - return Detail::unique_ptr( new TestInvokerAsMethod(testAsMethod) ); + return Detail::make_unique>( testAsMethod ); } struct NameAndTags { diff --git a/src/catch2/reporters/catch_reporter_console.cpp b/src/catch2/reporters/catch_reporter_console.cpp index e8970214..20f6b121 100644 --- a/src/catch2/reporters/catch_reporter_console.cpp +++ b/src/catch2/reporters/catch_reporter_console.cpp @@ -354,7 +354,7 @@ public: ConsoleReporter::ConsoleReporter(ReporterConfig const& config) : StreamingReporterBase(config), - m_tablePrinter(new TablePrinter(config.stream(), + m_tablePrinter(Detail::make_unique(config.stream(), [&config]() -> std::vector { if (config.fullConfig()->benchmarkNoAnalysis()) {