Skip to content

Commit

Permalink
Simplify boolean expresions
Browse files Browse the repository at this point in the history
Summary: Simplify few boolean expressions

Reviewed By: Filip-F

Differential Revision: D67604520

fbshipit-source-id: c174d47e7497cc4039e20ae0eee483a306907294
  • Loading branch information
yoney authored and facebook-github-bot committed Dec 23, 2024
1 parent 77da4c8 commit 9bcba81
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions third-party/thrift/src/thrift/compiler/generate/json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ namespace {
void rtrim(std::string& s) {
s.erase(
std::find_if(
s.rbegin(),
s.rend(),
[](int ch) { return !(ch == ' ' || ch == ','); })
s.rbegin(), s.rend(), [](int ch) { return ch != ' ' && ch != ','; })
.base(),
s.end());
}
Expand Down Expand Up @@ -102,7 +100,7 @@ std::ostream& json_quote_ascii(std::ostream& o, const std::string& s) {
// clang-format on
default: {
uint8_t b = static_cast<uint8_t>(c);
if (!(b >= 0x20 && b < 0x80)) {
if (b < 0x20 || b >= 0x80) {
constexpr auto hex = "0123456789abcdef";
auto c1 = static_cast<char>(hex[(b >> 4) & 0x0f]);
auto c0 = static_cast<char>(hex[(b >> 0) & 0x0f]);
Expand Down

0 comments on commit 9bcba81

Please sign in to comment.