Skip to content

Commit

Permalink
Apply most of readability-simplify-boolean-expr from clang-tidy (#16635)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 authored and pull[bot] committed Feb 16, 2024
1 parent 737118f commit 8279993
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 22 deletions.
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/common/CHIPCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void CHIPCommand::StartTracing()
{
chip::trace::SetTraceStream(new chip::trace::TraceStreamFile(mTraceFile.Value()));
}
else if (mTraceLog.HasValue() && mTraceLog.Value() == true)
else if (mTraceLog.HasValue() && mTraceLog.Value())
{
chip::trace::SetTraceStream(new chip::trace::TraceStreamLog());
}
Expand Down
10 changes: 5 additions & 5 deletions examples/chip-tool/commands/common/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,23 +227,23 @@ void Commands::ShowCluster(std::string executable, std::string clusterName, Comm

if (IsGlobalCommand(command->GetName()))
{
if (strcmp(command->GetName(), "read") == 0 && readCommand == false)
if (strcmp(command->GetName(), "read") == 0 && !readCommand)
{
readCommand = true;
}
else if (strcmp(command->GetName(), "write") == 0 && writeCommand == false)
else if (strcmp(command->GetName(), "write") == 0 && !writeCommand)
{
writeCommand = true;
}
else if (strcmp(command->GetName(), "subscribe") == 0 && subscribeCommand == false)
else if (strcmp(command->GetName(), "subscribe") == 0 && !subscribeCommand)
{
subscribeCommand = true;
}
else if (strcmp(command->GetName(), "read-event") == 0 && readEventCommand == false)
else if (strcmp(command->GetName(), "read-event") == 0 && !readEventCommand)
{
readEventCommand = true;
}
else if (strcmp(command->GetName(), "subscribe-event") == 0 && subscribeEventCommand == false)
else if (strcmp(command->GetName(), "subscribe-event") == 0 && !subscribeEventCommand)
{
subscribeEventCommand = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ CHIP_ERROR DiscoveryCommands::SetupDiscoveryCommands()
{
ReturnErrorOnFailure(TearDownDiscoveryCommands());

if (mReady == false)
if (!mReady)
{
ReturnErrorOnFailure(mDNSResolver.Init(chip::DeviceLayer::UDPEndPointManager()));
mReady = true;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/asn1/ASN1Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ CHIP_ERROR ASN1Reader::DecodeHead()

mHeadLen = static_cast<uint32_t>(p - mElemStart);

EndOfContents = (Class == kASN1TagClass_Universal && Tag == 0 && Constructed == false && ValueLen == 0);
EndOfContents = (Class == kASN1TagClass_Universal && Tag == 0 && !Constructed && ValueLen == 0);

Value = p;

Expand Down
17 changes: 4 additions & 13 deletions src/lib/dnssd/Resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,8 @@ struct ResolvedNodeData
// If either retry interval (Idle - CRI, Active - CRA) has a value and that value is greater
// than the value passed to this function, then the peer device will be treated as if it is
// a Sleepy End Device (SED)
if ((mMrpRetryIntervalIdle.HasValue() && (mMrpRetryIntervalIdle.Value() > defaultMRPConfig->mIdleRetransTimeout)) ||
(mMrpRetryIntervalActive.HasValue() && (mMrpRetryIntervalActive.Value() > defaultMRPConfig->mActiveRetransTimeout)))
{
return true;
}
return false;
return (mMrpRetryIntervalIdle.HasValue() && (mMrpRetryIntervalIdle.Value() > defaultMRPConfig->mIdleRetransTimeout)) ||
(mMrpRetryIntervalActive.HasValue() && (mMrpRetryIntervalActive.Value() > defaultMRPConfig->mActiveRetransTimeout));
}

PeerId mPeerId;
Expand Down Expand Up @@ -156,13 +152,8 @@ struct DiscoveredNodeData
// If either retry interval (Idle - CRI, Active - CRA) has a value and that value is greater
// than the value passed to this function, then the peer device will be treated as if it is
// a Sleepy End Device (SED)
if ((mrpRetryIntervalIdle.HasValue() && (mrpRetryIntervalIdle.Value() > defaultMRPConfig->mIdleRetransTimeout)) ||
(mrpRetryIntervalActive.HasValue() && (mrpRetryIntervalActive.Value() > defaultMRPConfig->mActiveRetransTimeout)))

{
return true;
}
return false;
return (mrpRetryIntervalIdle.HasValue() && (mrpRetryIntervalIdle.Value() > defaultMRPConfig->mIdleRetransTimeout)) ||
(mrpRetryIntervalActive.HasValue() && (mrpRetryIntervalActive.Value() > defaultMRPConfig->mActiveRetransTimeout));
}

void LogDetail() const
Expand Down
2 changes: 1 addition & 1 deletion src/platform/Linux/ConnectivityUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ CHIP_ERROR ConnectivityUtils::GetEthFullDuplex(const char * ifname, bool & fullD
}
else
{
fullDuplex = (ecmd.duplex == DUPLEX_FULL) ? true : false;
fullDuplex = ecmd.duplex == DUPLEX_FULL;
err = CHIP_NO_ERROR;
}

Expand Down

0 comments on commit 8279993

Please sign in to comment.