[clang-tidy] Do not use else after return
Found with readability-else-after-return Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
6317f9a406
commit
e4c669453c
@ -637,7 +637,7 @@ bool Reader::decodeString(Token& token, String& decoded) {
|
||||
Char c = *current++;
|
||||
if (c == '"')
|
||||
break;
|
||||
else if (c == '\\') {
|
||||
if (c == '\\') {
|
||||
if (current == end)
|
||||
return addError("Empty escape sequence in string", token, current);
|
||||
Char escape = *current++;
|
||||
@ -1358,11 +1358,10 @@ bool OurReader::readCStyleComment(bool* containsNewLineResult) {
|
||||
|
||||
while ((current_ + 1) < end_) {
|
||||
Char c = getNextChar();
|
||||
if (c == '*' && *current_ == '/') {
|
||||
if (c == '*' && *current_ == '/')
|
||||
break;
|
||||
} else if (c == '\n') {
|
||||
if (c == '\n')
|
||||
*containsNewLineResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
return getNextChar() == '/';
|
||||
@ -1669,9 +1668,9 @@ bool OurReader::decodeString(Token& token, String& decoded) {
|
||||
Location end = token.end_ - 1; // do not include '"'
|
||||
while (current != end) {
|
||||
Char c = *current++;
|
||||
if (c == '"') {
|
||||
if (c == '"')
|
||||
break;
|
||||
} else if (c == '\\') {
|
||||
if (c == '\\') {
|
||||
if (current == end)
|
||||
return addError("Empty escape sequence in string", token, current);
|
||||
Char escape = *current++;
|
||||
|
@ -875,8 +875,7 @@ ArrayIndex Value::size() const {
|
||||
bool Value::empty() const {
|
||||
if (isNull() || isArray() || isObject())
|
||||
return size() == 0U;
|
||||
else
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
Value::operator bool() const { return !isNull(); }
|
||||
@ -1137,13 +1136,12 @@ bool Value::insert(ArrayIndex index, Value&& newValue) {
|
||||
ArrayIndex length = size();
|
||||
if (index > length) {
|
||||
return false;
|
||||
} else {
|
||||
for (ArrayIndex i = length; i > index; i--) {
|
||||
(*this)[i] = std::move((*this)[i - 1]);
|
||||
}
|
||||
(*this)[index] = std::move(newValue);
|
||||
return true;
|
||||
}
|
||||
for (ArrayIndex i = length; i > index; i--) {
|
||||
(*this)[i] = std::move((*this)[i - 1]);
|
||||
}
|
||||
(*this)[index] = std::move(newValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
Value Value::get(char const* begin, char const* end,
|
||||
|
@ -267,19 +267,18 @@ bool Runner::runAllTest(bool printSummary) const {
|
||||
printf("All %zu tests passed\n", count);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
for (auto& result : failures) {
|
||||
result.printFailure(count > 1);
|
||||
}
|
||||
|
||||
if (printSummary) {
|
||||
size_t const failedCount = failures.size();
|
||||
size_t const passedCount = count - failedCount;
|
||||
printf("%zu/%zu tests passed (%zu failure(s))\n", passedCount, count,
|
||||
failedCount);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
for (auto& result : failures) {
|
||||
result.printFailure(count > 1);
|
||||
}
|
||||
|
||||
if (printSummary) {
|
||||
size_t const failedCount = failures.size();
|
||||
size_t const passedCount = count - failedCount;
|
||||
printf("%zu/%zu tests passed (%zu failure(s))\n", passedCount, count,
|
||||
failedCount);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Runner::testIndex(const Json::String& testName, size_t& indexOut) const {
|
||||
@ -308,7 +307,8 @@ int Runner::runCommandLine(int argc, const char* argv[]) const {
|
||||
if (opt == "--list-tests") {
|
||||
listTests();
|
||||
return 0;
|
||||
} else if (opt == "--test-auto") {
|
||||
}
|
||||
if (opt == "--test-auto") {
|
||||
preventDialogOnCrash();
|
||||
} else if (opt == "--test") {
|
||||
++index;
|
||||
|
Loading…
Reference in New Issue
Block a user