From 24678f9feea13dd5a8732c9697a63f9d24aadff5 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 9 May 2020 17:41:32 -0700 Subject: [PATCH] [clang-tidy] don't use else after return Found with readability-else-after-return Signed-off-by: Rosen Penev --- include/cxxopts.hpp | 43 +++++++++++-------------------------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index eba3c05..a677f9c 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -901,10 +901,7 @@ namespace cxxopts { return *m_result; } - else - { - return *m_store; - } + return *m_store; } protected: @@ -1657,10 +1654,7 @@ OptionAdder::operator() { return std::make_tuple(long_.str(), short_.str()); } - else - { - return std::make_tuple(short_.str(), long_.str()); - } + return std::make_tuple(short_.str(), long_.str()); }(short_match, long_match); m_options.add_option @@ -1766,22 +1760,13 @@ ParseResult::consume_positional(std::string a) ++m_next_positional; return true; } - else - { - ++m_next_positional; - continue; - } - } - else - { - add_to_option(*m_next_positional, a); - return true; + ++m_next_positional; + continue; } + add_to_option(*m_next_positional, a); + return true; } - else - { - throw_or_mimic(*m_next_positional); - } + throw_or_mimic(*m_next_positional); } return false; @@ -1882,11 +1867,8 @@ ParseResult::parse(int& argc, char**& argv) { continue; } - else - { - //error - throw_or_mimic(name); - } + //error + throw_or_mimic(name); } auto value = iter->second; @@ -1923,11 +1905,8 @@ ParseResult::parse(int& argc, char**& argv) ++current; continue; } - else - { - //error - throw_or_mimic(name); - } + //error + throw_or_mimic(name); } auto opt = iter->second;