Skip to content

Commit

Permalink
cleanup: prepare for clang-tidy 18 (#14160)
Browse files Browse the repository at this point in the history
Remove redundant inline
  • Loading branch information
alevenberg committed May 8, 2024
1 parent 6c959f4 commit b539a14
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

// Rest status code semantics for retrying requests.
struct DatasetRetryTraits {
static inline bool IsPermanentFailure(google::cloud::Status const& status) {
static bool IsPermanentFailure(google::cloud::Status const& status) {
return status.code() != StatusCode::kResourceExhausted &&
status.code() != StatusCode::kUnavailable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

// Rest status code semantics for retrying requests.
struct BigQueryJobRetryTraits {
static inline bool IsPermanentFailure(google::cloud::Status const& status) {
static bool IsPermanentFailure(google::cloud::Status const& status) {
return status.code() != StatusCode::kDeadlineExceeded &&
status.code() != StatusCode::kResourceExhausted &&
status.code() != StatusCode::kUnavailable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

// Rest status code semantics for retrying requests.
struct ProjectRetryTraits {
static inline bool IsPermanentFailure(google::cloud::Status const& status) {
static bool IsPermanentFailure(google::cloud::Status const& status) {
return status.code() != StatusCode::kResourceExhausted &&
status.code() != StatusCode::kUnavailable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

// Rest status code semantics for retrying requests.
struct TableRetryTraits {
static inline bool IsPermanentFailure(google::cloud::Status const& status) {
static bool IsPermanentFailure(google::cloud::Status const& status) {
return status.code() != StatusCode::kResourceExhausted &&
status.code() != StatusCode::kUnavailable;
}
Expand Down
12 changes: 6 additions & 6 deletions google/cloud/bigtable/internal/retry_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

/// An adapter to use `grpc::Status` with the `google::cloud::*Policies`.
struct SafeGrpcRetry {
static inline bool IsOk(Status const& status) { return status.ok(); }
static inline bool IsTransientFailure(Status const& status) {
static bool IsOk(Status const& status) { return status.ok(); }
static bool IsTransientFailure(Status const& status) {
auto const code = status.code();
return code == StatusCode::kAborted || code == StatusCode::kUnavailable ||
google::cloud::internal::IsTransientInternalError(status);
}
static inline bool IsPermanentFailure(Status const& status) {
static bool IsPermanentFailure(Status const& status) {
return !IsOk(status) && !IsTransientFailure(status);
}

// TODO(#2344) - remove ::grpc::Status version.
static inline bool IsOk(grpc::Status const& status) { return status.ok(); }
static inline bool IsTransientFailure(grpc::Status const& status) {
static bool IsOk(grpc::Status const& status) { return status.ok(); }
static bool IsTransientFailure(grpc::Status const& status) {
return IsTransientFailure(MakeStatusFromRpcError(status));
}
static inline bool IsPermanentFailure(grpc::Status const& status) {
static bool IsPermanentFailure(grpc::Status const& status) {
return !IsOk(status) && !IsTransientFailure(status);
}
};
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/internal/oauth2_compute_engine_credentials.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ DoMetadataServerGetRequest(rest_internal::RestClient& client,
}

struct DefaultUniverseDomainRetryTraits {
static inline bool IsPermanentFailure(google::cloud::Status const& status) {
static bool IsPermanentFailure(google::cloud::Status const& status) {
return status.code() != StatusCode::kOk &&
status.code() != StatusCode::kUnavailable;
}
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/internal/retry_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class RetryInfo {

std::chrono::nanoseconds retry_delay() const { return retry_delay_; }

friend inline bool operator==(RetryInfo const& a, RetryInfo const& b) {
friend bool operator==(RetryInfo const& a, RetryInfo const& b) {
return a.retry_delay_ == b.retry_delay_;
}

friend inline bool operator!=(RetryInfo const& a, RetryInfo const& b) {
friend bool operator!=(RetryInfo const& a, RetryInfo const& b) {
return !(a == b);
}

Expand Down
2 changes: 1 addition & 1 deletion google/cloud/pubsub/retry_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace pubsub_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
/// Define the gRPC status code semantics for retrying requests.
struct RetryTraits {
static inline bool IsPermanentFailure(google::cloud::Status const& status) {
static bool IsPermanentFailure(google::cloud::Status const& status) {
return status.code() != StatusCode::kOk &&
status.code() != StatusCode::kAborted &&
status.code() != StatusCode::kInternal &&
Expand Down
16 changes: 6 additions & 10 deletions google/cloud/spanner/retry_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,24 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

/// Define the gRPC status code semantics for retrying requests.
struct SafeGrpcRetry {
static inline bool IsOk(google::cloud::Status const& status) {
return status.ok();
}
static inline bool IsTransientFailure(google::cloud::Status const& status) {
static bool IsOk(google::cloud::Status const& status) { return status.ok(); }
static bool IsTransientFailure(google::cloud::Status const& status) {
return status.code() == StatusCode::kUnavailable ||
status.code() == StatusCode::kResourceExhausted ||
internal::IsTransientInternalError(status);
}
static inline bool IsPermanentFailure(google::cloud::Status const& status) {
static bool IsPermanentFailure(google::cloud::Status const& status) {
return !IsOk(status) && !IsTransientFailure(status);
}
};

/// Define the gRPC status code semantics for rerunning transactions.
struct SafeTransactionRerun {
static inline bool IsOk(google::cloud::Status const& status) {
return status.ok();
}
static inline bool IsTransientFailure(google::cloud::Status const& status) {
static bool IsOk(google::cloud::Status const& status) { return status.ok(); }
static bool IsTransientFailure(google::cloud::Status const& status) {
return status.code() == StatusCode::kAborted || IsSessionNotFound(status);
}
static inline bool IsPermanentFailure(google::cloud::Status const& status) {
static bool IsPermanentFailure(google::cloud::Status const& status) {
return !IsOk(status) && !IsTransientFailure(status);
}
};
Expand Down
6 changes: 2 additions & 4 deletions google/cloud/status.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,13 @@ class Status::Impl {
// `internal::SetPayload()` function.
PayloadType& payload() { return payload_; }

friend inline bool operator==(Impl const& a, Impl const& b) {
friend bool operator==(Impl const& a, Impl const& b) {
return a.code_ == b.code_ && a.message_ == b.message_ &&
a.error_info_ == b.error_info_ && a.retry_info_ == b.retry_info_ &&
a.payload_ == b.payload_;
}

friend inline bool operator!=(Impl const& a, Impl const& b) {
return !(a == b);
}
friend bool operator!=(Impl const& a, Impl const& b) { return !(a == b); }

private:
StatusCode code_;
Expand Down
6 changes: 2 additions & 4 deletions google/cloud/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,10 @@ class Status {
*/
ErrorInfo const& error_info() const;

friend inline bool operator==(Status const& a, Status const& b) {
friend bool operator==(Status const& a, Status const& b) {
return (a.ok() && b.ok()) || Equals(a, b);
}
friend inline bool operator!=(Status const& a, Status const& b) {
return !(a == b);
}
friend bool operator!=(Status const& a, Status const& b) { return !(a == b); }

private:
static bool Equals(Status const& a, Status const& b);
Expand Down

0 comments on commit b539a14

Please sign in to comment.