Fix 26 ClangTidy - Readability findings in //depot/google3/third_party/quic/. These fixes are automatically created by various analysis tools, but their application in this CL has been manually triggered. See go/code-findings-fixes. * redundant get() call on smart pointer (11 times) * using decl 'Perspective' is unused * using decl 'SETTINGS_MAX_HEADER_LIST_SIZE' is unused (2 times) * using decl 'AtLeast' is unused * using decl 'SpdySettingsIR' is unused * using decl 'Pair' is unused * using decl 'UnorderedElementsAre' is unused * using decl 'Values' is unused * using decl 'Combine' is unused * using decl 'Invoke' is unused * lambda capture 'this' is not used (4 times) * using decl 'QuicSocketAddress' is unused PiperOrigin-RevId: 276529025 Change-Id: Icee20b5bab6c9d8cc6c95b74594469257e791cb0
diff --git a/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc b/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc index dd8a680..9ce4bda 100644 --- a/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc +++ b/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc
@@ -269,7 +269,7 @@ // handle an AAD that is set to nullptr, as opposed // to a zero-length, non-nullptr pointer. aad.length() ? aad : QuicStringPiece(), ciphertext)); - if (!decrypted.get()) { + if (!decrypted) { EXPECT_FALSE(has_pt); continue; }
diff --git a/quic/core/crypto/aes_128_gcm_decrypter_test.cc b/quic/core/crypto/aes_128_gcm_decrypter_test.cc index 54793f8..579f76d 100644 --- a/quic/core/crypto/aes_128_gcm_decrypter_test.cc +++ b/quic/core/crypto/aes_128_gcm_decrypter_test.cc
@@ -258,7 +258,7 @@ // handle an AAD that is set to nullptr, as opposed // to a zero-length, non-nullptr pointer. aad.length() ? aad : QuicStringPiece(), ciphertext)); - if (!decrypted.get()) { + if (!decrypted) { EXPECT_FALSE(has_pt); continue; }
diff --git a/quic/core/crypto/aes_256_gcm_decrypter_test.cc b/quic/core/crypto/aes_256_gcm_decrypter_test.cc index 73a3b3d..b3d61c7 100644 --- a/quic/core/crypto/aes_256_gcm_decrypter_test.cc +++ b/quic/core/crypto/aes_256_gcm_decrypter_test.cc
@@ -262,7 +262,7 @@ // handle an AAD that is set to nullptr, as opposed // to a zero-length, non-nullptr pointer. aad.length() ? aad : QuicStringPiece(), ciphertext)); - if (!decrypted.get()) { + if (!decrypted) { EXPECT_FALSE(has_pt); continue; }
diff --git a/quic/core/crypto/chacha20_poly1305_decrypter_test.cc b/quic/core/crypto/chacha20_poly1305_decrypter_test.cc index a9c4999..930af24 100644 --- a/quic/core/crypto/chacha20_poly1305_decrypter_test.cc +++ b/quic/core/crypto/chacha20_poly1305_decrypter_test.cc
@@ -159,7 +159,7 @@ // is set to nullptr, as opposed to a zero-length, non-nullptr pointer. QuicStringPiece(aad.length() ? aad.data() : nullptr, aad.length()), ct)); - if (!decrypted.get()) { + if (!decrypted) { EXPECT_FALSE(has_pt); continue; }
diff --git a/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc b/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc index ce4dea9..90052d6 100644 --- a/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc +++ b/quic/core/crypto/chacha20_poly1305_tls_decrypter_test.cc
@@ -154,7 +154,7 @@ // is set to nullptr, as opposed to a zero-length, non-nullptr pointer. QuicStringPiece(aad.length() ? aad.data() : nullptr, aad.length()), ct)); - if (!decrypted.get()) { + if (!decrypted) { EXPECT_FALSE(has_pt); continue; }
diff --git a/quic/core/crypto/crypto_handshake_message.cc b/quic/core/crypto/crypto_handshake_message.cc index 022a86b..762a279 100644 --- a/quic/core/crypto/crypto_handshake_message.cc +++ b/quic/core/crypto/crypto_handshake_message.cc
@@ -57,7 +57,7 @@ } const QuicData& CryptoHandshakeMessage::GetSerialized() const { - if (!serialized_.get()) { + if (!serialized_) { serialized_ = CryptoFramer::ConstructHandshakeMessage(*this); } return *serialized_;
diff --git a/quic/core/crypto/crypto_message_printer_bin.cc b/quic/core/crypto/crypto_message_printer_bin.cc index ecbcab8..67cd531 100644 --- a/quic/core/crypto/crypto_message_printer_bin.cc +++ b/quic/core/crypto/crypto_message_printer_bin.cc
@@ -14,7 +14,6 @@ #include "net/third_party/quiche/src/quic/core/quic_utils.h" #include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h" -using quic::Perspective; using std::cerr; using std::cout; using std::endl;
diff --git a/quic/core/crypto/quic_crypto_client_config.cc b/quic/core/crypto/quic_crypto_client_config.cc index 75b2e6a..6813f7c 100644 --- a/quic/core/crypto/quic_crypto_client_config.cc +++ b/quic/core/crypto/quic_crypto_client_config.cc
@@ -120,7 +120,7 @@ return nullptr; } - if (!scfg_.get()) { + if (!scfg_) { scfg_ = CryptoFramer::ParseMessage(server_config_); DCHECK(scfg_.get()); }
diff --git a/quic/core/crypto/quic_crypto_server_config.cc b/quic/core/crypto/quic_crypto_server_config.cc index c211cdb..c23cf0f 100644 --- a/quic/core/crypto/quic_crypto_server_config.cc +++ b/quic/core/crypto/quic_crypto_server_config.cc
@@ -385,14 +385,14 @@ std::unique_ptr<CryptoHandshakeMessage> msg = CryptoFramer::ParseMessage(protobuf.config()); - if (!msg.get()) { + if (!msg) { QUIC_LOG(WARNING) << "Failed to parse server config message"; return nullptr; } QuicReferenceCountedPointer<Config> config = ParseConfigProtobuf(protobuf, /* is_fallback = */ false); - if (!config.get()) { + if (!config) { QUIC_LOG(WARNING) << "Failed to parse server config message"; return nullptr; } @@ -896,7 +896,7 @@ } std::unique_ptr<CryptoHandshakeMessage> cetv(CryptoFramer::ParseMessage( QuicStringPiece(plaintext, plaintext_length))); - if (!cetv.get()) { + if (!cetv) { context->Fail(QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER, "CETV parse error"); return; }
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc index cbb4ca8..e39b90a 100644 --- a/quic/core/http/end_to_end_test.cc +++ b/quic/core/http/end_to_end_test.cc
@@ -66,7 +66,6 @@ #include "net/third_party/quiche/src/quic/tools/quic_simple_server_stream.h" using spdy::kV3LowestPriority; -using spdy::SETTINGS_MAX_HEADER_LIST_SIZE; using spdy::SpdyFramer; using spdy::SpdyHeaderBlock; using spdy::SpdySerializedFrame;
diff --git a/quic/core/http/quic_headers_stream_test.cc b/quic/core/http/quic_headers_stream_test.cc index 83acfe7..2e6b729 100644 --- a/quic/core/http/quic_headers_stream_test.cc +++ b/quic/core/http/quic_headers_stream_test.cc
@@ -36,7 +36,6 @@ using spdy::SETTINGS_INITIAL_WINDOW_SIZE; using spdy::SETTINGS_MAX_CONCURRENT_STREAMS; using spdy::SETTINGS_MAX_FRAME_SIZE; -using spdy::SETTINGS_MAX_HEADER_LIST_SIZE; using spdy::Spdy3PriorityToHttp2Weight; using spdy::SpdyAltSvcWireFormat; using spdy::SpdyDataIR;
diff --git a/quic/core/http/quic_receive_control_stream_test.cc b/quic/core/http/quic_receive_control_stream_test.cc index c8df8a0..7374513 100644 --- a/quic/core/http/quic_receive_control_stream_test.cc +++ b/quic/core/http/quic_receive_control_stream_test.cc
@@ -18,7 +18,6 @@ namespace { using ::testing::_; -using ::testing::AtLeast; using ::testing::StrictMock; struct TestParams {
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc index 8b42a90..064f403 100644 --- a/quic/core/http/quic_spdy_session.cc +++ b/quic/core/http/quic_spdy_session.cc
@@ -46,7 +46,6 @@ using spdy::SpdyPushPromiseIR; using spdy::SpdySerializedFrame; using spdy::SpdySettingsId; -using spdy::SpdySettingsIR; using spdy::SpdyStreamId; namespace quic {
diff --git a/quic/core/http/spdy_server_push_utils_test.cc b/quic/core/http/spdy_server_push_utils_test.cc index 72d4a25..0f6ec8a 100644 --- a/quic/core/http/spdy_server_push_utils_test.cc +++ b/quic/core/http/spdy_server_push_utils_test.cc
@@ -13,8 +13,6 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h" using spdy::SpdyHeaderBlock; -using testing::Pair; -using testing::UnorderedElementsAre; namespace quic { namespace test {
diff --git a/quic/core/qpack/qpack_instruction_encoder_test.cc b/quic/core/qpack/qpack_instruction_encoder_test.cc index 0d172cd..abd1353 100644 --- a/quic/core/qpack/qpack_instruction_encoder_test.cc +++ b/quic/core/qpack/qpack_instruction_encoder_test.cc
@@ -8,8 +8,6 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" #include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h" -using ::testing::Values; - namespace quic { namespace test { namespace {
diff --git a/quic/core/qpack/qpack_round_trip_test.cc b/quic/core/qpack/qpack_round_trip_test.cc index 567676c..cb2c514 100644 --- a/quic/core/qpack/qpack_round_trip_test.cc +++ b/quic/core/qpack/qpack_round_trip_test.cc
@@ -13,7 +13,6 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" #include "net/third_party/quiche/src/spdy/core/spdy_header_block.h" -using ::testing::Combine; using ::testing::Values; namespace quic {
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc index 2d4d4a5..b219042 100644 --- a/quic/core/quic_framer.cc +++ b/quic/core/quic_framer.cc
@@ -1904,7 +1904,7 @@ std::unique_ptr<CryptoHandshakeMessage> reset( CryptoFramer::ParseMessage(reader->ReadRemainingPayload())); - if (!reset.get()) { + if (!reset) { set_detailed_error("Unable to read reset message."); RecordDroppedPacketReason(DroppedPacketReason::INVALID_PUBLIC_RESET_PACKET); return RaiseError(QUIC_INVALID_PUBLIC_RST_PACKET);
diff --git a/quic/core/quic_stream_id_manager_test.cc b/quic/core/quic_stream_id_manager_test.cc index 7b7fb1a..2ff55be 100644 --- a/quic/core/quic_stream_id_manager_test.cc +++ b/quic/core/quic_stream_id_manager_test.cc
@@ -13,7 +13,6 @@ #include "net/third_party/quiche/src/quic/test_tools/quic_stream_id_manager_peer.h" using testing::_; -using testing::Invoke; using testing::StrictMock; namespace quic {
diff --git a/quic/qbone/platform/netlink_test.cc b/quic/qbone/platform/netlink_test.cc index 7bd5f6b..04ce68c 100644 --- a/quic/qbone/platform/netlink_test.cc +++ b/quic/qbone/platform/netlink_test.cc
@@ -45,7 +45,7 @@ InSequence s; EXPECT_CALL(mock_kernel_, sendmsg(kSocketFd, _, _)) - .WillOnce(Invoke([this, type, flags, send_callback]( + .WillOnce(Invoke([type, flags, send_callback]( Unused, const struct msghdr* msg, int) { EXPECT_EQ(sizeof(struct sockaddr_nl), msg->msg_namelen); auto* nl_addr = @@ -251,7 +251,7 @@ ExpectNetlinkPacket( RTM_GETLINK, NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST, - [this, &hwaddr, &bcaddr](void* buf, size_t len, int seq) { + [&hwaddr, &bcaddr](void* buf, size_t len, int seq) { int ret = 0; struct nlmsghdr* netlink_message = @@ -291,7 +291,7 @@ ExpectNetlinkPacket( RTM_GETADDR, NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST, - [this, &addresses](void* buf, size_t len, int seq) { + [&addresses](void* buf, size_t len, int seq) { int ret = 0; struct nlmsghdr* nlm = nullptr;
diff --git a/quic/qbone/qbone_session_test.cc b/quic/qbone/qbone_session_test.cc index dee951e..8a12cec 100644 --- a/quic/qbone/qbone_session_test.cc +++ b/quic/qbone/qbone_session_test.cc
@@ -170,7 +170,7 @@ class FakeTaskRunner { public: explicit FakeTaskRunner(MockQuicConnectionHelper* helper) - : tasks_([this](const TaskType& l, const TaskType& r) { + : tasks_([](const TaskType& l, const TaskType& r) { // Items at a later time should run after items at an earlier time. // Priority queue comparisons should return true if l appears after r. return l->time() > r->time();
diff --git a/quic/tools/quic_toy_client.cc b/quic/tools/quic_toy_client.cc index a9a3886..4159735 100644 --- a/quic/tools/quic_toy_client.cc +++ b/quic/tools/quic_toy_client.cc
@@ -63,7 +63,6 @@ namespace { -using quic::QuicSocketAddress; using quic::QuicStringPiece; using quic::QuicTextUtils; using quic::QuicUrl;