[clang-tidy] readability-simplify-boolean-expr (#5716)

This commit is contained in:
Jonathan Hui
2020-10-27 16:03:17 -07:00
committed by GitHub
parent 81688a0447
commit 5711151d08
4 changed files with 8 additions and 7 deletions
+1
View File
@@ -119,6 +119,7 @@ readonly OT_CLANG_TIDY_CHECKS="\
modernize-use-bool-literals,\
modernize-use-nullptr,\
readability-make-member-function-const,\
readability-simplify-boolean-expr,\
"
#performance-for-range-copy\
+1 -1
View File
@@ -2291,7 +2291,7 @@ void Mac::SetCslChannel(uint8_t aChannel)
VerifyOrExit(GetCslChannel() != aChannel);
mSubMac.SetCslChannel(aChannel);
mSubMac.SetCslChannelSpecified(aChannel != 0 ? true : false);
mSubMac.SetCslChannelSpecified(aChannel != 0);
if (IsCslEnabled())
{
+5 -5
View File
@@ -277,9 +277,9 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NET_STACK_UP>(void)
SuccessOrExit(error = mDecoder.ReadBool(enabled));
// If the value has changed...
if ((enabled != false) != (otThreadGetDeviceRole(mInstance) != OT_DEVICE_ROLE_DISABLED))
if (enabled != (otThreadGetDeviceRole(mInstance) != OT_DEVICE_ROLE_DISABLED))
{
if (enabled != false)
if (enabled)
{
error = otThreadSetEnabled(mInstance, true);
StartLegacy();
@@ -679,7 +679,7 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_ALLOW_LOCAL_NE
SuccessOrExit(error = mDecoder.ReadBool(value));
// Register any net data changes on transition from `true` to `false`.
shouldRegisterWithLeader = (mAllowLocalNetworkDataChange == true) && (value == false);
shouldRegisterWithLeader = mAllowLocalNetworkDataChange && !value;
mAllowLocalNetworkDataChange = value;
@@ -819,7 +819,7 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_SERVER_ALLOW_LOCAL_DA
SuccessOrExit(error = mDecoder.ReadBool(value));
// Register any server data changes on transition from `true` to `false`.
shouldRegisterWithLeader = (mAllowLocalServerDataChange == true) && (value == false);
shouldRegisterWithLeader = mAllowLocalServerDataChange && !value;
mAllowLocalServerDataChange = value;
@@ -1467,7 +1467,7 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MESHCOP_JOINER_COMMIS
SuccessOrExit(error = mDecoder.ReadBool(action));
if (action == false)
if (!action)
{
otJoinerStop(mInstance);
ExitNow();
+1 -1
View File
@@ -346,7 +346,7 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_PHY_ENABLED>(void)
SuccessOrExit(error = mDecoder.ReadBool(value));
if (value == false)
if (!value)
{
error = otLinkRawSetReceiveDone(mInstance, nullptr);
}