From f04c93462b3eba1845ed05bb9198d14cbba60b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 19 Feb 2023 20:23:36 +0100 Subject: [PATCH] Small refactoring in AssertionResult --- src/catch2/catch_assertion_result.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/catch2/catch_assertion_result.cpp b/src/catch2/catch_assertion_result.cpp index ee81758a..61d4fd06 100644 --- a/src/catch2/catch_assertion_result.cpp +++ b/src/catch2/catch_assertion_result.cpp @@ -68,16 +68,15 @@ namespace Catch { } std::string AssertionResult::getExpressionInMacro() const { - std::string expr; - if( m_info.macroName.empty() ) - expr = static_cast(m_info.capturedExpression); - else { - expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); - expr += m_info.macroName; - expr += "( "; - expr += m_info.capturedExpression; - expr += " )"; + if ( m_info.macroName.empty() ) { + return static_cast( m_info.capturedExpression ); } + std::string expr; + expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); + expr += m_info.macroName; + expr += "( "; + expr += m_info.capturedExpression; + expr += " )"; return expr; }