From 83f3bc4dffc58f2834335bfc99caf0323ae97641 Mon Sep 17 00:00:00 2001 From: Eric Katzfey Date: Fri, 7 Jul 2023 11:01:44 -0700 Subject: [PATCH] Fixed Clang tidy errors --- platforms/nuttx/src/px4/common/SerialImpl.cpp | 24 ++++--------------- platforms/posix/src/px4/common/SerialImpl.cpp | 24 ++++--------------- platforms/qurt/src/px4/SerialImpl.cpp | 24 ++++--------------- 3 files changed, 12 insertions(+), 60 deletions(-) diff --git a/platforms/nuttx/src/px4/common/SerialImpl.cpp b/platforms/nuttx/src/px4/common/SerialImpl.cpp index 83c5f354ff..29134dc80a 100644 --- a/platforms/nuttx/src/px4/common/SerialImpl.cpp +++ b/platforms/nuttx/src/px4/common/SerialImpl.cpp @@ -319,11 +319,7 @@ ByteSize SerialImpl::getBytesize() const bool SerialImpl::setBytesize(ByteSize bytesize) { - if (bytesize != ByteSize::EightBits) { - return false; - } - - return true; + return bytesize == ByteSize::EightBits; } Parity SerialImpl::getParity() const @@ -333,11 +329,7 @@ Parity SerialImpl::getParity() const bool SerialImpl::setParity(Parity parity) { - if (parity != Parity::None) { - return false; - } - - return true; + return parity == Parity::None; } StopBits SerialImpl::getStopbits() const @@ -347,11 +339,7 @@ StopBits SerialImpl::getStopbits() const bool SerialImpl::setStopbits(StopBits stopbits) { - if (stopbits != StopBits::One) { - return false; - } - - return true; + return stopbits == StopBits::One; } FlowControl SerialImpl::getFlowcontrol() const @@ -361,11 +349,7 @@ FlowControl SerialImpl::getFlowcontrol() const bool SerialImpl::setFlowcontrol(FlowControl flowcontrol) { - if (flowcontrol != FlowControl::Disabled) { - return false; - } - - return true; + return flowcontrol == FlowControl::Disabled; } } // namespace device diff --git a/platforms/posix/src/px4/common/SerialImpl.cpp b/platforms/posix/src/px4/common/SerialImpl.cpp index 71aa15b8bc..7e181de881 100644 --- a/platforms/posix/src/px4/common/SerialImpl.cpp +++ b/platforms/posix/src/px4/common/SerialImpl.cpp @@ -317,11 +317,7 @@ ByteSize SerialImpl::getBytesize() const bool SerialImpl::setBytesize(ByteSize bytesize) { - if (bytesize != ByteSize::EightBits) { - return false; - } - - return true; + return bytesize == ByteSize::EightBits; } Parity SerialImpl::getParity() const @@ -331,11 +327,7 @@ Parity SerialImpl::getParity() const bool SerialImpl::setParity(Parity parity) { - if (parity != Parity::None) { - return false; - } - - return true; + return parity == Parity::None; } StopBits SerialImpl::getStopbits() const @@ -345,11 +337,7 @@ StopBits SerialImpl::getStopbits() const bool SerialImpl::setStopbits(StopBits stopbits) { - if (stopbits != StopBits::One) { - return false; - } - - return true; + return stopbits == StopBits::One; } FlowControl SerialImpl::getFlowcontrol() const @@ -359,11 +347,7 @@ FlowControl SerialImpl::getFlowcontrol() const bool SerialImpl::setFlowcontrol(FlowControl flowcontrol) { - if (flowcontrol != FlowControl::Disabled) { - return false; - } - - return true; + return flowcontrol == FlowControl::Disabled; } } // namespace device diff --git a/platforms/qurt/src/px4/SerialImpl.cpp b/platforms/qurt/src/px4/SerialImpl.cpp index cfdbddc4ba..a231d241ac 100644 --- a/platforms/qurt/src/px4/SerialImpl.cpp +++ b/platforms/qurt/src/px4/SerialImpl.cpp @@ -245,11 +245,7 @@ ByteSize SerialImpl::getBytesize() const bool SerialImpl::setBytesize(ByteSize bytesize) { - if (bytesize != ByteSize::EightBits) { - return false; - } - - return true; + return bytesize == ByteSize::EightBits; } Parity SerialImpl::getParity() const @@ -259,11 +255,7 @@ Parity SerialImpl::getParity() const bool SerialImpl::setParity(Parity parity) { - if (parity != Parity::None) { - return false; - } - - return true; + return parity == Parity::None; } StopBits SerialImpl::getStopbits() const @@ -273,11 +265,7 @@ StopBits SerialImpl::getStopbits() const bool SerialImpl::setStopbits(StopBits stopbits) { - if (stopbits != StopBits::One) { - return false; - } - - return true; + return stopbits == StopBits::One; } FlowControl SerialImpl::getFlowcontrol() const @@ -287,11 +275,7 @@ FlowControl SerialImpl::getFlowcontrol() const bool SerialImpl::setFlowcontrol(FlowControl flowcontrol) { - if (flowcontrol != FlowControl::Disabled) { - return false; - } - - return true; + return flowcontrol == FlowControl::Disabled; } } // namespace device