Merge pull request #24456 from veblush/tidy-readability-redundant-smartptr-get

[Clang-Tidy] readability-redundant-smartptr-get
pull/24472/head
Esun Kim 4 years ago committed by GitHub
commit bba8facb4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .clang-tidy
  2. 6
      src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h
  3. 4
      src/core/lib/security/security_connector/tls/tls_security_connector.cc
  4. 2
      src/cpp/server/server_cc.cc
  5. 4
      test/cpp/end2end/generic_end2end_test.cc
  6. 6
      test/cpp/util/proto_file_parser.cc

@ -36,7 +36,7 @@ Checks: '-*,
readability-function-size,
-readability-inconsistent-declaration-parameter-name,
-readability-redundant-control-flow,
-readability-redundant-smartptr-get,
readability-redundant-smartptr-get,
-readability-string-compare'
WarningsAsErrors: '*'
CheckOptions:

@ -247,13 +247,13 @@ struct grpc_tls_credentials_options
public:
~grpc_tls_credentials_options() override {
if (key_materials_config_.get() != nullptr) {
key_materials_config_.get()->Unref();
key_materials_config_->Unref();
}
if (credential_reload_config_.get() != nullptr) {
credential_reload_config_.get()->Unref();
credential_reload_config_->Unref();
}
if (server_authorization_check_config_.get() != nullptr) {
server_authorization_check_config_.get()->Unref();
server_authorization_check_config_->Unref();
}
}

@ -160,7 +160,7 @@ TlsChannelSecurityConnector::~TlsChannelSecurityConnector() {
tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_);
}
if (key_materials_config_.get() != nullptr) {
key_materials_config_.get()->Unref();
key_materials_config_->Unref();
}
ServerAuthorizationCheckArgDestroy(check_arg_);
}
@ -469,7 +469,7 @@ TlsServerSecurityConnector::~TlsServerSecurityConnector() {
tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_);
}
if (key_materials_config_.get() != nullptr) {
key_materials_config_.get()->Unref();
key_materials_config_->Unref();
}
}

@ -1020,7 +1020,7 @@ bool Server::RegisterService(const std::string* host, grpc::Service* service) {
const char* method_name = nullptr;
for (const auto& method : service->methods_) {
if (method.get() == nullptr) { // Handled by generic service if any.
if (method == nullptr) { // Handled by generic service if any.
continue;
}

@ -287,8 +287,8 @@ TEST_F(GenericEnd2endTest, SequentialUnaryRpcs) {
SerializeToByteBuffer(&send_request);
std::thread request_call([this]() { server_ok(4); });
std::unique_ptr<GenericClientAsyncResponseReader> call =
generic_stub_->PrepareUnaryCall(&cli_ctx, kMethodName,
*cli_send_buffer.get(), &cli_cq_);
generic_stub_->PrepareUnaryCall(&cli_ctx, kMethodName, *cli_send_buffer,
&cli_cq_);
call->StartCall();
ByteBuffer cli_recv_buffer;
call->Finish(&cli_recv_buffer, &recv_status, tag(1));

@ -302,14 +302,14 @@ std::string ProtoFileParser::GetFormattedStringFromMessageType(
if (is_json_format) {
grpc::protobuf::json::JsonPrintOptions jsonPrintOptions;
jsonPrintOptions.add_whitespace = true;
if (!grpc::protobuf::json::MessageToJsonString(
*msg.get(), &formatted_string, jsonPrintOptions)
if (!grpc::protobuf::json::MessageToJsonString(*msg, &formatted_string,
jsonPrintOptions)
.ok()) {
LogError("Failed to print proto message to json format");
return "";
}
} else {
if (!protobuf::TextFormat::PrintToString(*msg.get(), &formatted_string)) {
if (!protobuf::TextFormat::PrintToString(*msg, &formatted_string)) {
LogError("Failed to print proto message to text format");
return "";
}

Loading…
Cancel
Save