Fix 28 ClangTidy - Readability findings in modules/rtp_rtcp/ These fixes are automatically created by various analysis tools, but have been manually triggered to be applied. * the 'empty' method should be used to check for emptiness instead of 'size' (3 times) * using decl 'Return' is unused (4 times) * using decl '_' is unused (3 times) * using decl 'DoAll' is unused (2 times) * using decl 'SetArgPointee' is unused * using decl 'Dlrr' is unused * using decl 'IsEmpty' is unused * redundant get() call on smart pointer * using decl 'Invoke' is unused (2 times) * using decl 'SizeIs' is unused (3 times) * using decl 'make_tuple' is unused * using decl 'NiceMock' is unused * using decl 'SaveArg' is unused (2 times) * using decl 'AtLeast' is unused * using decl 'ElementsAre' is unused * using decl 'Gt' is unused Bug: None Change-Id: I97658fb0e94620b8319d7c3da29b15e27ec23188 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151133 Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29056}
diff --git a/modules/rtp_rtcp/include/rtp_rtcp_defines.cc b/modules/rtp_rtcp/include/rtp_rtcp_defines.cc index 7f8efca..16f571f 100644 --- a/modules/rtp_rtcp/include/rtp_rtcp_defines.cc +++ b/modules/rtp_rtcp/include/rtp_rtcp_defines.cc
@@ -33,12 +33,12 @@ } // namespace bool IsLegalMidName(absl::string_view name) { - return (name.size() <= kMidRsidMaxSize && name.size() > 0 && + return (name.size() <= kMidRsidMaxSize && !name.empty() && absl::c_all_of(name, IsTokenChar)); } bool IsLegalRsidName(absl::string_view name) { - return (name.size() <= kMidRsidMaxSize && name.size() > 0 && + return (name.size() <= kMidRsidMaxSize && !name.empty() && absl::c_all_of(name, isalnum)); }
diff --git a/modules/rtp_rtcp/source/flexfec_receiver_unittest.cc b/modules/rtp_rtcp/source/flexfec_receiver_unittest.cc index 3d77d7b..be64bac 100644 --- a/modules/rtp_rtcp/source/flexfec_receiver_unittest.cc +++ b/modules/rtp_rtcp/source/flexfec_receiver_unittest.cc
@@ -27,7 +27,6 @@ using ::testing::_; using ::testing::Args; using ::testing::ElementsAreArray; -using ::testing::Return; using test::fec::FlexfecPacketGenerator; using Packet = ForwardErrorCorrection::Packet;
diff --git a/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc b/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc index 9f42f57..c9b9434d 100644 --- a/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc +++ b/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc
@@ -14,11 +14,6 @@ #include "test/gmock.h" #include "test/gtest.h" -using ::testing::_; -using ::testing::DoAll; -using ::testing::Return; -using ::testing::SetArgPointee; - namespace webrtc { static const int64_t kTestRtt = 10;
diff --git a/modules/rtp_rtcp/source/rtcp_packet/extended_reports_unittest.cc b/modules/rtp_rtcp/source/rtcp_packet/extended_reports_unittest.cc index a302a5b..7c50c01 100644 --- a/modules/rtp_rtcp/source/rtcp_packet/extended_reports_unittest.cc +++ b/modules/rtp_rtcp/source/rtcp_packet/extended_reports_unittest.cc
@@ -19,7 +19,6 @@ using ::testing::ElementsAreArray; using ::testing::make_tuple; using ::testing::SizeIs; -using webrtc::rtcp::Dlrr; using webrtc::rtcp::ExtendedReports; using webrtc::rtcp::ReceiveTimeInfo; using webrtc::rtcp::Rrtr;
diff --git a/modules/rtp_rtcp/source/rtcp_packet/tmmbr_unittest.cc b/modules/rtp_rtcp/source/rtcp_packet/tmmbr_unittest.cc index a320f23..1bac808 100644 --- a/modules/rtp_rtcp/source/rtcp_packet/tmmbr_unittest.cc +++ b/modules/rtp_rtcp/source/rtcp_packet/tmmbr_unittest.cc
@@ -15,7 +15,6 @@ #include "test/rtcp_packet_parser.h" using ::testing::ElementsAreArray; -using ::testing::IsEmpty; using ::testing::make_tuple; using webrtc::rtcp::TmmbItem; using webrtc::rtcp::Tmmbr;
diff --git a/modules/rtp_rtcp/source/rtcp_sender.cc b/modules/rtp_rtcp/source/rtcp_sender.cc index c06a428..4c1a241 100644 --- a/modules/rtp_rtcp/source/rtcp_sender.cc +++ b/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -743,7 +743,7 @@ BuilderFunc func = builder_it->second; std::unique_ptr<rtcp::RtcpPacket> packet = (this->*func)(context); - if (packet.get() == nullptr) + if (packet == nullptr) return -1; // If there is a BYE, don't append now - save it and append it // at the end later.
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc b/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc index fac1735..ebfb068 100644 --- a/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc +++ b/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc
@@ -32,7 +32,6 @@ using ::testing::_; using ::testing::ElementsAre; -using ::testing::Invoke; using ::testing::Return; using ::testing::SizeIs; using ::testing::StrictMock;
diff --git a/modules/rtp_rtcp/source/rtp_format_video_generic_unittest.cc b/modules/rtp_rtcp/source/rtp_format_video_generic_unittest.cc index 9ba0573..67b7cba 100644 --- a/modules/rtp_rtcp/source/rtp_format_video_generic_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_format_video_generic_unittest.cc
@@ -30,7 +30,6 @@ using ::testing::Each; using ::testing::ElementsAreArray; using ::testing::Le; -using ::testing::SizeIs; constexpr RtpPacketizer::PayloadSizeLimits kNoSizeLimits;
diff --git a/modules/rtp_rtcp/source/rtp_packet_unittest.cc b/modules/rtp_rtcp/source/rtp_packet_unittest.cc index b583477..150dba7 100644 --- a/modules/rtp_rtcp/source/rtp_packet_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_packet_unittest.cc
@@ -23,7 +23,6 @@ using ::testing::ElementsAre; using ::testing::ElementsAreArray; using ::testing::IsEmpty; -using ::testing::make_tuple; constexpr int8_t kPayloadType = 100; constexpr uint32_t kSsrc = 0x12345678;
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index d8ffd22..eaba788 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -694,7 +694,7 @@ if (!rtp_sender_) return; - if (!rtp_sender_->StorePackets() || nack_sequence_numbers.size() == 0) { + if (!rtp_sender_->StorePackets() || nack_sequence_numbers.empty()) { return; } // Use RTT from RtcpRttStats class if provided.
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc index f55e4f8..3cec171 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc
@@ -29,11 +29,7 @@ #include "test/rtcp_packet_parser.h" #include "test/rtp_header_parser.h" -using ::testing::_; using ::testing::ElementsAre; -using ::testing::NiceMock; -using ::testing::Return; -using ::testing::SaveArg; namespace webrtc { namespace {
diff --git a/modules/rtp_rtcp/source/rtp_sender_audio_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_audio_unittest.cc index 1dad5b7..1e5b38b 100644 --- a/modules/rtp_rtcp/source/rtp_sender_audio_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_sender_audio_unittest.cc
@@ -33,7 +33,6 @@ const uint8_t kAudioLevel = 0x5a; const uint64_t kStartTime = 123456789; -using ::testing::_; using ::testing::ElementsAreArray; class LoopbackTransportTest : public webrtc::Transport {
diff --git a/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_unittest.cc index ad501df..7c4c374 100644 --- a/modules/rtp_rtcp/source/rtp_sender_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_sender_unittest.cc
@@ -74,19 +74,12 @@ using ::testing::_; using ::testing::AllOf; -using ::testing::AtLeast; -using ::testing::DoAll; -using ::testing::ElementsAre; using ::testing::ElementsAreArray; using ::testing::Field; -using ::testing::Gt; -using ::testing::Invoke; using ::testing::NiceMock; using ::testing::Pointee; using ::testing::Property; using ::testing::Return; -using ::testing::SaveArg; -using ::testing::SizeIs; using ::testing::StrictMock; uint64_t ConvertMsToAbsSendTime(int64_t time_ms) {
diff --git a/modules/rtp_rtcp/source/source_tracker_unittest.cc b/modules/rtp_rtcp/source/source_tracker_unittest.cc index 55ae4d1..99e0372 100644 --- a/modules/rtp_rtcp/source/source_tracker_unittest.cc +++ b/modules/rtp_rtcp/source/source_tracker_unittest.cc
@@ -31,7 +31,6 @@ using ::testing::ElementsAre; using ::testing::ElementsAreArray; using ::testing::IsEmpty; -using ::testing::SizeIs; using ::testing::TestWithParam; using ::testing::Values;
diff --git a/modules/rtp_rtcp/source/ulpfec_receiver_unittest.cc b/modules/rtp_rtcp/source/ulpfec_receiver_unittest.cc index 32f3bbb..8e41c1c 100644 --- a/modules/rtp_rtcp/source/ulpfec_receiver_unittest.cc +++ b/modules/rtp_rtcp/source/ulpfec_receiver_unittest.cc
@@ -30,7 +30,6 @@ using ::testing::_; using ::testing::Args; using ::testing::ElementsAreArray; -using ::testing::Return; using test::fec::AugmentedPacket; using Packet = ForwardErrorCorrection::Packet;