From 62b50c612f68694662717acb11f3c0789159a978 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 23 Nov 2021 12:49:45 -0500 Subject: Cleanup: Else after return, other simplifications `std::stringstream` already returns a `std::string`, and there is no particular reason to use short here instead of int. --- source/blender/editors/space_node/node_draw.cc | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 1aa6ec4e56c..1d62321cae3 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -1664,24 +1664,22 @@ static std::string node_get_execution_time_label(const SpaceNode *snode, const b if (exec_time_us == 0) { return std::string("-"); } - else if (exec_time_us < 100) { + if (exec_time_us < 100) { return std::string("< 0.1 ms"); } - else { - short precision = 0; - /* Show decimal if value is below 1ms */ - if (exec_time_us < 1000) { - precision = 2; - } - else if (exec_time_us < 10000) { - precision = 1; - } - std::stringstream stream; - stream << std::fixed << std::setprecision(precision) << (exec_time_us / 1000.0f); - return std::string(stream.str() + " ms"); + int precision = 0; + /* Show decimal if value is below 1ms */ + if (exec_time_us < 1000) { + precision = 2; } - return std::string(""); + else if (exec_time_us < 10000) { + precision = 1; + } + + std::stringstream stream; + stream << std::fixed << std::setprecision(precision) << (exec_time_us / 1000.0f); + return stream.str() + " ms"; } struct NodeExtraInfoRow { -- cgit v1.2.3