remove else after return

This commit is contained in:
Bernd Amend 2021-05-22 13:55:04 +02:00
parent bd933592a9
commit c26fd14953
2 changed files with 6 additions and 18 deletions

View File

@ -17,9 +17,8 @@ bool run_test_type_conversion(const Boxed_Value &bv, bool expectedpass)
if (expectedpass) { if (expectedpass) {
std::cerr << "Failure in run_test_type_conversion: " << e.what() << '\n'; std::cerr << "Failure in run_test_type_conversion: " << e.what() << '\n';
return false; return false;
} else {
return true;
} }
return true;
} catch (const std::exception &e) { } catch (const std::exception &e) {
std::cerr << "Unexpected standard exception when attempting cast_conversion: " << e.what() << '\n'; std::cerr << "Unexpected standard exception when attempting cast_conversion: " << e.what() << '\n';
return false; return false;
@ -28,12 +27,7 @@ bool run_test_type_conversion(const Boxed_Value &bv, bool expectedpass)
return false; return false;
} }
if (expectedpass) return expectedpass;
{
return true;
} else {
return false;
}
} }
template<typename To> template<typename To>
@ -287,8 +281,6 @@ bool pointer_test(const T& default_value, const T& new_value)
delete p; delete p;
return false; return false;
} }
} }
@ -315,11 +307,9 @@ int main()
// storing a pointer // storing a pointer
passed &= pointer_test<int>(1, 0); passed &= pointer_test<int>(1, 0);
if (passed) if (passed) {
{
return EXIT_SUCCESS; return EXIT_SUCCESS;
} else {
return EXIT_FAILURE;
} }
return EXIT_FAILURE;
} }

View File

@ -25,9 +25,8 @@ bool test_literal(T val, const std::string &str, bool use_boxed_number = false)
T val2 = [&](){ T val2 = [&](){
if (!use_boxed_number) { if (!use_boxed_number) {
return chai.eval<T>(str); return chai.eval<T>(str);
} else {
return chai.eval<chaiscript::Boxed_Number>(str).get_as_checked<T>();
} }
return chai.eval<chaiscript::Boxed_Number>(str).get_as_checked<T>();
}(); }();
std::cout << "' chai '" << val2 << "'\n"; std::cout << "' chai '" << val2 << "'\n";
@ -272,10 +271,9 @@ int main()
) )
{ {
return EXIT_SUCCESS; return EXIT_SUCCESS;
} else {
return EXIT_FAILURE;
} }
return EXIT_FAILURE;
} }