mirror of
https://github.com/espressif/openthread.git
synced 2026-08-23 10:49:51 +00:00
[clang-tidy] readability-simplify-boolean-expr (#5716)
This commit is contained in:
@@ -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\
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user