From 691fb0a8a95299afc1b8c537e1624a2731a52b47 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 30 Jan 2025 01:23:40 +0000 Subject: [PATCH] [Cleanup] Avoid std::make_pair --- src/compiler/python_generator.cc | 28 +++++++++---------- src/core/channelz/channelz.cc | 4 +-- .../server/chaotic_good_server.cc | 2 +- .../ext/transport/inproc/inproc_transport.cc | 3 +- src/core/filter/blackboard.cc | 4 +-- .../authorization/cel_authorization_engine.cc | 4 +-- src/core/lib/surface/channel.cc | 4 +-- src/core/server/server.cc | 6 ++-- src/core/util/time.cc | 2 +- src/core/xds/xds_client/lrs_client.cc | 8 +++--- src/cpp/client/client_context.cc | 2 +- src/cpp/ext/csm/metadata_exchange.cc | 7 ++--- .../load_reporter/get_cpu_stats_linux.cc | 2 +- .../load_reporter/get_cpu_stats_macos.cc | 2 +- .../get_cpu_stats_unsupported.cc | 2 +- .../load_reporter/get_cpu_stats_windows.cc | 2 +- src/cpp/server/secure_server_credentials.cc | 4 +-- src/cpp/server/server_context.cc | 4 +-- .../event_engine/event_engine_test_utils.cc | 2 +- test/core/memory_usage/client.cc | 2 +- .../transport/chttp2/hpack_sync_fuzzer.cc | 2 +- test/core/xds/xds_client_test.cc | 3 +- .../client_interceptors_end2end_test.cc | 8 +++--- test/cpp/end2end/end2end_test.cc | 8 +++--- .../xds/xds_override_host_end2end_test.cc | 2 +- test/cpp/ext/otel/otel_plugin_test.cc | 16 +++++------ test/cpp/interop/stress_test.cc | 2 +- test/cpp/util/metrics_server.cc | 2 +- .../codegen/core/gen_huffman_decompressor.cc | 4 +-- 29 files changed, 68 insertions(+), 73 deletions(-) diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index 6213b32527833..c88c5685d640b 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -42,7 +42,6 @@ using grpc::protobuf::FileDescriptor; using grpc::protobuf::compiler::GeneratorContext; using grpc::protobuf::io::CodedOutputStream; using grpc::protobuf::io::ZeroCopyOutputStream; -using std::make_pair; using std::map; using std::pair; using std::replace; @@ -234,11 +233,11 @@ bool PrivateGenerator::PrintBetaServerFactory( return false; } method_implementation_constructors.insert( - make_pair(method->name(), method_implementation_constructor)); + pair(method->name(), method_implementation_constructor)); input_message_modules_and_classes.insert( - make_pair(method->name(), input_message_module_and_class)); + pair(method->name(), input_message_module_and_class)); output_message_modules_and_classes.insert( - make_pair(method->name(), output_message_module_and_class)); + pair(method->name(), output_message_module_and_class)); } StringMap method_dict; method_dict["PackageQualifiedServiceName"] = package_qualified_service_name; @@ -341,12 +340,11 @@ bool PrivateGenerator::PrintBetaStubFactory( config.prefixes_to_filter)) { return false; } - method_cardinalities.insert( - make_pair(method->name(), method_cardinality)); + method_cardinalities.insert(pair(method->name(), method_cardinality)); input_message_modules_and_classes.insert( - make_pair(method->name(), input_message_module_and_class)); + pair(method->name(), input_message_module_and_class)); output_message_modules_and_classes.insert( - make_pair(method->name(), output_message_module_and_class)); + pair(method->name(), output_message_module_and_class)); } StringMap method_dict; method_dict["PackageQualifiedServiceName"] = package_qualified_service_name; @@ -838,10 +836,10 @@ pair PrivateGenerator::GetGrpcServices() { "Client and server classes corresponding to protobuf-defined " "services.\"\"\"\n"); if (!PrintPreamble(out.get())) { - return make_pair(false, ""); + return pair(false, ""); } if (!PrintGAServices(out.get())) { - return make_pair(false, ""); + return pair(false, ""); } } else { out->Print("try:\n"); @@ -851,16 +849,16 @@ pair PrivateGenerator::GetGrpcServices() { "# THESE ELEMENTS WILL BE DEPRECATED.\n" "# Please use the generated *_pb2_grpc.py files instead.\n"); if (!PrintPreamble(out.get())) { - return make_pair(false, ""); + return pair(false, ""); } if (!PrintBetaPreamble(out.get())) { - return make_pair(false, ""); + return pair(false, ""); } if (!PrintGAServices(out.get())) { - return make_pair(false, ""); + return pair(false, ""); } if (!PrintBetaServices(out.get())) { - return make_pair(false, ""); + return pair(false, ""); } } out->Print("except ImportError:\n"); @@ -870,7 +868,7 @@ pair PrivateGenerator::GetGrpcServices() { } } } - return make_pair(true, std::move(output)); + return pair(true, std::move(output)); } } // namespace diff --git a/src/core/channelz/channelz.cc b/src/core/channelz/channelz.cc index 1a8aa222a7292..945e47affe97b 100644 --- a/src/core/channelz/channelz.cc +++ b/src/core/channelz/channelz.cc @@ -334,7 +334,7 @@ ServerNode::~ServerNode() {} void ServerNode::AddChildSocket(RefCountedPtr node) { MutexLock lock(&child_mu_); - child_sockets_.insert(std::make_pair(node->uuid(), std::move(node))); + child_sockets_.insert(std::pair(node->uuid(), std::move(node))); } void ServerNode::RemoveChildSocket(intptr_t child_uuid) { @@ -344,7 +344,7 @@ void ServerNode::RemoveChildSocket(intptr_t child_uuid) { void ServerNode::AddChildListenSocket(RefCountedPtr node) { MutexLock lock(&child_mu_); - child_listen_sockets_.insert(std::make_pair(node->uuid(), std::move(node))); + child_listen_sockets_.insert(std::pair(node->uuid(), std::move(node))); } void ServerNode::RemoveChildListenSocket(intptr_t child_uuid) { diff --git a/src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc b/src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc index 9653016ac6589..b13a54b4b65e7 100644 --- a/src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc +++ b/src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc @@ -528,7 +528,7 @@ int grpc_server_add_chaotic_good_port(grpc_server* server, const char* addr) { auto bind_result = listener->Bind(ee_addr); if (!bind_result.ok()) { error_list.push_back( - std::make_pair(std::move(addr_str), bind_result.status())); + std::pair(std::move(addr_str), bind_result.status())); continue; } if (port_num == 0) { diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc index ef0cd9bc1a8eb..8ec96100c457d 100644 --- a/src/core/ext/transport/inproc/inproc_transport.cc +++ b/src/core/ext/transport/inproc/inproc_transport.cc @@ -281,8 +281,7 @@ MakeInProcessTransportPair(const ChannelArgs& server_channel_args) { auto server_transport = MakeOrphanable(server_channel_args); auto client_transport = server_transport->MakeClientTransport(); - return std::make_pair(std::move(client_transport), - std::move(server_transport)); + return std::pair(std::move(client_transport), std::move(server_transport)); } } // namespace grpc_core diff --git a/src/core/filter/blackboard.cc b/src/core/filter/blackboard.cc index b916bf77d8fd5..3f57acd0f796d 100644 --- a/src/core/filter/blackboard.cc +++ b/src/core/filter/blackboard.cc @@ -20,14 +20,14 @@ namespace grpc_core { RefCountedPtr Blackboard::Get(UniqueTypeName type, const std::string& key) const { - auto it = map_.find(std::make_pair(type, key)); + auto it = map_.find(std::pair(type, key)); if (it == map_.end()) return nullptr; return it->second; } void Blackboard::Set(UniqueTypeName type, const std::string& key, RefCountedPtr entry) { - map_[std::make_pair(type, key)] = std::move(entry); + map_[std::pair(type, key)] = std::move(entry); } } // namespace grpc_core diff --git a/src/core/lib/security/authorization/cel_authorization_engine.cc b/src/core/lib/security/authorization/cel_authorization_engine.cc index c81887b5f4f4e..8ad835f760ba9 100644 --- a/src/core/lib/security/authorization/cel_authorization_engine.cc +++ b/src/core/lib/security/authorization/cel_authorization_engine.cc @@ -89,9 +89,9 @@ CelAuthorizationEngine::CelAuthorizationEngine( google_api_expr_v1alpha1_Expr_parse(serialized, serial_len, arena_.ptr()); if (envoy_config_rbac_v3_RBAC_action(rbac_policy) == kAllow) { - allow_if_matched_.insert(std::make_pair(policy_name, parsed_condition)); + allow_if_matched_.insert(std::pair(policy_name, parsed_condition)); } else { - deny_if_matched_.insert(std::make_pair(policy_name, parsed_condition)); + deny_if_matched_.insert(std::pair(policy_name, parsed_condition)); } } } diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index bc2b62c134016..47dead9978abd 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -72,8 +72,8 @@ Channel::Channel(std::string target, const ChannelArgs& channel_args) Channel::RegisteredCall* Channel::RegisterCall(const char* method, const char* host) { MutexLock lock(&mu_); - auto key = std::make_pair(std::string(host != nullptr ? host : ""), - std::string(method != nullptr ? method : "")); + auto key = std::pair(std::string(host != nullptr ? host : ""), + std::string(method != nullptr ? method : "")); auto rc_posn = registration_table_.find(key); if (rc_posn != registration_table_.end()) { return &rc_posn->second; diff --git a/src/core/server/server.cc b/src/core/server/server.cc index c6691b4edfe47..bda6feaea0818 100644 --- a/src/core/server/server.cc +++ b/src/core/server/server.cc @@ -1343,7 +1343,7 @@ Server::RegisteredMethod* Server::RegisterMethod( LOG(ERROR) << "grpc_server_register_method method string cannot be NULL"; return nullptr; } - auto key = std::make_pair(host ? host : "", method); + auto key = std::pair(host ? host : "", method); if (registered_methods_.find(key) != registered_methods_.end()) { LOG(ERROR) << "duplicate registration for " << method << "@" << (host ? host : "*"); @@ -1697,12 +1697,12 @@ Server::RegisteredMethod* Server::GetRegisteredMethod( const absl::string_view& host, const absl::string_view& path) { if (registered_methods_.empty()) return nullptr; // check for an exact match with host - auto it = registered_methods_.find(std::make_pair(host, path)); + auto it = registered_methods_.find(std::pair(host, path)); if (it != registered_methods_.end()) { return it->second.get(); } // check for wildcard method definition (no host set) - it = registered_methods_.find(std::make_pair("", path)); + it = registered_methods_.find(std::pair("", path)); if (it != registered_methods_.end()) { return it->second.get(); } diff --git a/src/core/util/time.cc b/src/core/util/time.cc index 2d7c6873c1084..f14ae8c03880b 100644 --- a/src/core/util/time.cc +++ b/src/core/util/time.cc @@ -84,7 +84,7 @@ GPR_ATTRIBUTE_NOINLINE std::pair InitTime() { g_process_epoch_cycles.store(process_epoch_cycles, std::memory_order_relaxed); } - return std::make_pair(process_epoch_seconds, process_epoch_cycles); + return std::pair(process_epoch_seconds, process_epoch_cycles); } gpr_timespec StartTime() { diff --git a/src/core/xds/xds_client/lrs_client.cc b/src/core/xds/xds_client/lrs_client.cc index 7fbb86c9b1ebe..ab565603dc3d9 100644 --- a/src/core/xds/xds_client/lrs_client.cc +++ b/src/core/xds/xds_client/lrs_client.cc @@ -810,7 +810,7 @@ RefCountedPtr LrsClient::AddClusterDropStats( std::shared_ptr lrs_server, absl::string_view cluster_name, absl::string_view eds_service_name) { auto key = - std::make_pair(std::string(cluster_name), std::string(eds_service_name)); + std::pair(std::string(cluster_name), std::string(eds_service_name)); RefCountedPtr cluster_drop_stats; { MutexLock lock(&mu_); @@ -856,7 +856,7 @@ void LrsClient::RemoveClusterDropStats( if (server_it == load_report_map_.end()) return; auto& server = server_it->second; auto load_report_it = server.load_report_map.find( - std::make_pair(std::string(cluster_name), std::string(eds_service_name))); + std::pair(std::string(cluster_name), std::string(eds_service_name))); if (load_report_it == server.load_report_map.end()) return; LoadReportState& load_report_state = load_report_it->second; if (load_report_state.drop_stats == cluster_drop_stats) { @@ -875,7 +875,7 @@ LrsClient::AddClusterLocalityStats( RefCountedPtr locality, RefCountedPtr backend_metric_propagation) { auto key = - std::make_pair(std::string(cluster_name), std::string(eds_service_name)); + std::pair(std::string(cluster_name), std::string(eds_service_name)); RefCountedPtr cluster_locality_stats; { MutexLock lock(&mu_); @@ -929,7 +929,7 @@ void LrsClient::RemoveClusterLocalityStats( if (server_it == load_report_map_.end()) return; auto& server = server_it->second; auto load_report_it = server.load_report_map.find( - std::make_pair(std::string(cluster_name), std::string(eds_service_name))); + std::pair(std::string(cluster_name), std::string(eds_service_name))); if (load_report_it == server.load_report_map.end()) return; LoadReportState& load_report_state = load_report_it->second; auto locality_it = load_report_state.locality_stats.find(locality); diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index e338d440b9ca0..d5dd3055c294c 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -117,7 +117,7 @@ std::unique_ptr ClientContext::FromCallbackServerContext( void ClientContext::AddMetadata(const std::string& meta_key, const std::string& meta_value) { - send_initial_metadata_.insert(std::make_pair(meta_key, meta_value)); + send_initial_metadata_.insert(std::pair(meta_key, meta_value)); } void ClientContext::set_call(grpc_call* call, diff --git a/src/cpp/ext/csm/metadata_exchange.cc b/src/cpp/ext/csm/metadata_exchange.cc index 66cbb28abc5ef..abe38ccd853f2 100644 --- a/src/cpp/ext/csm/metadata_exchange.cc +++ b/src/cpp/ext/csm/metadata_exchange.cc @@ -210,10 +210,9 @@ NextFromAttributeList(absl::Span attributes, const size_t index = curr - start_index; if (index >= attributes.size()) return std::nullopt; const auto& attribute = attributes[index]; - return std::make_pair( - attribute.otel_attribute, - GetStringValueFromUpbStruct(decoded_metadata, - attribute.metadata_attribute, arena)); + return std::pair(attribute.otel_attribute, + GetStringValueFromUpbStruct( + decoded_metadata, attribute.metadata_attribute, arena)); } } // namespace diff --git a/src/cpp/server/load_reporter/get_cpu_stats_linux.cc b/src/cpp/server/load_reporter/get_cpu_stats_linux.cc index ee2fa144c1682..d750db9e4439a 100644 --- a/src/cpp/server/load_reporter/get_cpu_stats_linux.cc +++ b/src/cpp/server/load_reporter/get_cpu_stats_linux.cc @@ -44,7 +44,7 @@ std::pair GetCpuStatsImpl() { fclose(fp); busy = user + nice + system; total = busy + idle; - return std::make_pair(busy, total); + return std::pair(busy, total); } } // namespace load_reporter diff --git a/src/cpp/server/load_reporter/get_cpu_stats_macos.cc b/src/cpp/server/load_reporter/get_cpu_stats_macos.cc index d182adabe32f9..dedae24957a11 100644 --- a/src/cpp/server/load_reporter/get_cpu_stats_macos.cc +++ b/src/cpp/server/load_reporter/get_cpu_stats_macos.cc @@ -36,7 +36,7 @@ std::pair GetCpuStatsImpl() { for (int i = 0; i < CPU_STATE_MAX; i++) total += cpuinfo.cpu_ticks[i]; busy = total - cpuinfo.cpu_ticks[CPU_STATE_IDLE]; } - return std::make_pair(busy, total); + return std::pair(busy, total); } } // namespace load_reporter diff --git a/src/cpp/server/load_reporter/get_cpu_stats_unsupported.cc b/src/cpp/server/load_reporter/get_cpu_stats_unsupported.cc index 70b8c0851e39b..05790f69fa8c4 100644 --- a/src/cpp/server/load_reporter/get_cpu_stats_unsupported.cc +++ b/src/cpp/server/load_reporter/get_cpu_stats_unsupported.cc @@ -31,7 +31,7 @@ std::pair GetCpuStatsImpl() { uint64_t busy = 0, total = 0; LOG(ERROR) << "Platforms other than Linux, Windows, and MacOS are not supported."; - return std::make_pair(busy, total); + return std::pair(busy, total); } } // namespace load_reporter diff --git a/src/cpp/server/load_reporter/get_cpu_stats_windows.cc b/src/cpp/server/load_reporter/get_cpu_stats_windows.cc index defec9faddc6d..054b0a817e429 100644 --- a/src/cpp/server/load_reporter/get_cpu_stats_windows.cc +++ b/src/cpp/server/load_reporter/get_cpu_stats_windows.cc @@ -47,7 +47,7 @@ std::pair GetCpuStatsImpl() { total = FiletimeToInt(kernel) + FiletimeToInt(user); busy = total - FiletimeToInt(idle); } - return std::make_pair(busy, total); + return std::pair(busy, total); } } // namespace load_reporter diff --git a/src/cpp/server/secure_server_credentials.cc b/src/cpp/server/secure_server_credentials.cc index a522a9fdcdd5c..614c97f1a117d 100644 --- a/src/cpp/server/secure_server_credentials.cc +++ b/src/cpp/server/secure_server_credentials.cc @@ -65,8 +65,8 @@ void AuthMetadataProcessorAsyncWrapper::InvokeProcessor( grpc_process_auth_metadata_done_cb cb, void* user_data) { AuthMetadataProcessor::InputMetadata metadata; for (size_t i = 0; i < num_md; i++) { - metadata.insert(std::make_pair(StringRefFromSlice(&md[i].key), - StringRefFromSlice(&md[i].value))); + metadata.insert(std::pair(StringRefFromSlice(&md[i].key), + StringRefFromSlice(&md[i].value))); } SecureAuthContext ctx(context); AuthMetadataProcessor::OutputMetadata consumed_metadata; diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index ca8e3a4728fd9..19e6df7146cb7 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -325,12 +325,12 @@ internal::CompletionQueueTag* ServerContextBase::GetCompletionOpTag() { void ServerContextBase::AddInitialMetadata(const std::string& key, const std::string& value) { - initial_metadata_.insert(std::make_pair(key, value)); + initial_metadata_.insert(std::pair(key, value)); } void ServerContextBase::AddTrailingMetadata(const std::string& key, const std::string& value) { - trailing_metadata_.insert(std::make_pair(key, value)); + trailing_metadata_.insert(std::pair(key, value)); } void ServerContextBase::TryCancel() const { diff --git a/test/core/event_engine/event_engine_test_utils.cc b/test/core/event_engine/event_engine_test_utils.cc index 868f2ac2f5498..7d9c75c911b88 100644 --- a/test/core/event_engine/event_engine_test_utils.cc +++ b/test/core/event_engine/event_engine_test_utils.cc @@ -199,7 +199,7 @@ absl::Status ConnectionManager::BindAndStartListener( // Insert same listener pointer for all bind addresses after the listener // has started successfully. for (auto& addr : addrs) { - listeners_.insert(std::make_pair(addr, listener)); + listeners_.insert(std::pair(addr, listener)); } return absl::OkStatus(); } diff --git a/test/core/memory_usage/client.cc b/test/core/memory_usage/client.cc index a5fda509bc0c7..62e1f6e7273b5 100644 --- a/test/core/memory_usage/client.cc +++ b/test/core/memory_usage/client.cc @@ -193,7 +193,7 @@ std::pair run_test_loop(int iterations, int* call_idx) { init_ping_pong_request(*call_idx + i + 1); } - auto peak = std::make_pair( + auto peak = std::pair( // client MemStats::Snapshot(), // server diff --git a/test/core/transport/chttp2/hpack_sync_fuzzer.cc b/test/core/transport/chttp2/hpack_sync_fuzzer.cc index cee88c14bc893..fbf6d82e73786 100644 --- a/test/core/transport/chttp2/hpack_sync_fuzzer.cc +++ b/test/core/transport/chttp2/hpack_sync_fuzzer.cc @@ -137,7 +137,7 @@ void FuzzOneInput(const hpack_sync_fuzzer::Msg& msg) { encode_output.c_slice_at(i), i == (encode_output.Count() - 1), absl::BitGenRef(proto_bit_src), /*call_tracer=*/nullptr); if (!err.ok()) { - seen_errors.push_back(std::make_pair(i, err)); + seen_errors.push_back(std::pair(i, err)); // If we get a connection error (i.e. not a stream error), stop parsing, // return. if (!IsStreamError(err)) return; diff --git a/test/core/xds/xds_client_test.cc b/test/core/xds/xds_client_test.cc index 5fb0444f6e12f..99e9498d6c1c3 100644 --- a/test/core/xds/xds_client_test.cc +++ b/test/core/xds/xds_client_test.cc @@ -707,8 +707,7 @@ class XdsClientTest : public ::testing::Test { uint64_t num_resources_valid, uint64_t num_resources_invalid) override { MutexLock lock(&mu_); - auto key = - std::make_pair(std::string(xds_server), std::string(resource_type)); + auto key = std::pair(std::string(xds_server), std::string(resource_type)); if (num_resources_valid > 0) { resource_updates_valid_[key] += num_resources_valid; } diff --git a/test/cpp/end2end/client_interceptors_end2end_test.cc b/test/cpp/end2end/client_interceptors_end2end_test.cc index 85f7b15e1729f..3af7731c4e198 100644 --- a/test/cpp/end2end/client_interceptors_end2end_test.cc +++ b/test/cpp/end2end/client_interceptors_end2end_test.cc @@ -152,7 +152,7 @@ class HijackingInterceptor : public experimental::Interceptor { auto* map = methods->GetRecvTrailingMetadata(); // insert the metadata that we want EXPECT_EQ(map->size(), 0); - map->insert(std::make_pair("testkey", "testvalue")); + map->insert(std::pair("testkey", "testvalue")); auto* status = methods->GetRecvStatus(); *status = Status(StatusCode::OK, ""); } @@ -272,7 +272,7 @@ class HijackingInterceptorMakesAnotherCall : public experimental::Interceptor { auto* map = methods->GetRecvTrailingMetadata(); // insert the metadata that we want EXPECT_EQ(map->size(), 0); - map->insert(std::make_pair("testkey", "testvalue")); + map->insert(std::pair("testkey", "testvalue")); auto* status = methods->GetRecvStatus(); *status = Status(StatusCode::OK, ""); } @@ -353,7 +353,7 @@ class BidiStreamingRpcHijackingInterceptor : public experimental::Interceptor { auto* map = methods->GetRecvTrailingMetadata(); // insert the metadata that we want EXPECT_EQ(map->size(), 0); - map->insert(std::make_pair("testkey", "testvalue")); + map->insert(std::pair("testkey", "testvalue")); auto* status = methods->GetRecvStatus(); *status = Status(StatusCode::OK, ""); } @@ -497,7 +497,7 @@ class ServerStreamingRpcHijackingInterceptor auto* map = methods->GetRecvTrailingMetadata(); // insert the metadata that we want EXPECT_EQ(map->size(), 0); - map->insert(std::make_pair("testkey", "testvalue")); + map->insert(std::pair("testkey", "testvalue")); auto* status = methods->GetRecvStatus(); *status = Status(StatusCode::OK, ""); } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index f94f416b04fb0..aec0929ea8bc3 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -165,7 +165,7 @@ class TestMetadataCredentialsPlugin : public MetadataCredentialsPlugin { EXPECT_TRUE(channel_auth_context.IsPeerAuthenticated()); EXPECT_TRUE(metadata != nullptr); if (is_successful_) { - metadata->insert(std::make_pair(metadata_key_, metadata_value_)); + metadata->insert(std::pair(metadata_key_, metadata_value_)); return Status::OK; } else { return Status(StatusCode::NOT_FOUND, kTestCredsPluginErrorMsg); @@ -229,9 +229,9 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor { if (auth_md_value == kGoodGuy) { context->AddProperty(kIdentityPropName, kGoodGuy); context->SetPeerIdentityPropertyName(kIdentityPropName); - consumed_auth_metadata->insert(std::make_pair( - string(auth_md->first.data(), auth_md->first.length()), - string(auth_md->second.data(), auth_md->second.length()))); + consumed_auth_metadata->insert( + std::pair(string(auth_md->first.data(), auth_md->first.length()), + string(auth_md->second.data(), auth_md->second.length()))); return Status::OK; } else { return Status(StatusCode::UNAUTHENTICATED, diff --git a/test/cpp/end2end/xds/xds_override_host_end2end_test.cc b/test/cpp/end2end/xds/xds_override_host_end2end_test.cc index 04852bfa8fbaa..6e1d8a48cd3a3 100644 --- a/test/cpp/end2end/xds/xds_override_host_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_override_host_end2end_test.cc @@ -53,7 +53,7 @@ class OverrideHostTest : public XdsEnd2endTest { std::set attributes; std::pair Header() const { - return std::make_pair("cookie", absl::StrFormat("%s=%s", name, value)); + return std::pair("cookie", absl::StrFormat("%s=%s", name, value)); } template diff --git a/test/cpp/ext/otel/otel_plugin_test.cc b/test/cpp/ext/otel/otel_plugin_test.cc index 35be1c35fa7c0..64ca996ce592c 100644 --- a/test/cpp/ext/otel/otel_plugin_test.cc +++ b/test/cpp/ext/otel/otel_plugin_test.cc @@ -1133,7 +1133,7 @@ TEST_F(OpenTelemetryPluginOptionEnd2EndTest, Basic) { kServerCallDurationInstrumentName}) .add_plugin_option(std::make_unique( /*enabled_on_client*/ true, /*enabled_on_server*/ true, - std::make_pair("key", "value"))))); + std::pair("key", "value"))))); SendRPC(); auto data = ReadCurrentMetricsData( [&](const absl::flat_hash_map< @@ -1166,7 +1166,7 @@ TEST_F(OpenTelemetryPluginOptionEnd2EndTest, ClientOnlyPluginOption) { kServerCallDurationInstrumentName}) .add_plugin_option(std::make_unique( /*enabled_on_client*/ true, /*enabled_on_server*/ false, - std::make_pair("key", "value"))))); + std::pair("key", "value"))))); SendRPC(); auto data = ReadCurrentMetricsData( [&](const absl::flat_hash_map< @@ -1200,7 +1200,7 @@ TEST_F(OpenTelemetryPluginOptionEnd2EndTest, ServerOnlyPluginOption) { kServerCallDurationInstrumentName}) .add_plugin_option(std::make_unique( /*enabled_on_client*/ false, /*enabled_on_server*/ true, - std::make_pair("key", "value"))))); + std::pair("key", "value"))))); SendRPC(); auto data = ReadCurrentMetricsData( [&](const absl::flat_hash_map< @@ -1235,19 +1235,19 @@ TEST_F(OpenTelemetryPluginOptionEnd2EndTest, kServerCallDurationInstrumentName}) .add_plugin_option(std::make_unique( /*enabled_on_client*/ true, /*enabled_on_server*/ true, - std::make_pair("key1", "value1"))) + std::pair("key1", "value1"))) .add_plugin_option(std::make_unique( /*enabled_on_client*/ true, /*enabled_on_server*/ false, - std::make_pair("key2", "value2"))) + std::pair("key2", "value2"))) .add_plugin_option(std::make_unique( /*enabled_on_client*/ true, /*enabled_on_server*/ false, - std::make_pair("key3", "value3"))) + std::pair("key3", "value3"))) .add_plugin_option(std::make_unique( /*enabled_on_client*/ false, /*enabled_on_server*/ true, - std::make_pair("key4", "value4"))) + std::pair("key4", "value4"))) .add_plugin_option(std::make_unique( /*enabled_on_client*/ false, /*enabled_on_server*/ true, - std::make_pair("key5", "value5"))))); + std::pair("key5", "value5"))))); SendRPC(); auto data = ReadCurrentMetricsData( [&](const absl::flat_hash_map< diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc index addf9bfb14f23..538b66bb79200 100644 --- a/test/cpp/interop/stress_test.cc +++ b/test/cpp/interop/stress_test.cc @@ -186,7 +186,7 @@ bool ParseTestCasesString(const std::string& test_cases, break; } - tests.emplace_back(std::make_pair(test_case, weight)); + tests.emplace_back(std::pair(test_case, weight)); } return is_success; diff --git a/test/cpp/util/metrics_server.cc b/test/cpp/util/metrics_server.cc index fd149fa76b61b..a3830c73a8223 100644 --- a/test/cpp/util/metrics_server.cc +++ b/test/cpp/util/metrics_server.cc @@ -86,7 +86,7 @@ std::shared_ptr MetricsServiceImpl::CreateQpsGauge( std::lock_guard lock(mu_); std::shared_ptr qps_gauge(new QpsGauge()); - const auto p = qps_gauges_.insert(std::make_pair(name, qps_gauge)); + const auto p = qps_gauges_.insert(std::pair(name, qps_gauge)); // p.first is an iterator pointing to > pair. // p.second is a boolean which is set to 'true' if the QpsGauge is diff --git a/tools/codegen/core/gen_huffman_decompressor.cc b/tools/codegen/core/gen_huffman_decompressor.cc index 4be864bb1a398..0d0464cbcdac7 100644 --- a/tools/codegen/core/gen_huffman_decompressor.cc +++ b/tools/codegen/core/gen_huffman_decompressor.cc @@ -1246,8 +1246,8 @@ class FunMaker { std::string ReadBytes(int bytes_needed, int bytes_allowed) { auto fn_name = absl::StrCat("Read", bytes_needed, "to", bytes_allowed, "Bytes"); - if (have_reads_.count(std::make_pair(bytes_needed, bytes_allowed)) == 0) { - have_reads_.insert(std::make_pair(bytes_needed, bytes_allowed)); + if (have_reads_.count(std::pair(bytes_needed, bytes_allowed)) == 0) { + have_reads_.insert(std::pair(bytes_needed, bytes_allowed)); auto fn = NewFun(fn_name, "bool"); auto s = fn->Add("end_ - begin_"); for (int i = 0; i <= bytes_allowed; i++) {