Skip to content

Commit ba46f89

Browse files
authored
cleanup: changes following clang-tidy suggestions (#14976)
* cleanup: changes following clang-tidy suggestions * fix * fix
1 parent 4f5408d commit ba46f89

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

.clang-tidy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
# -modernize-type-traits: clang-tidy recommands using c++17 style variable
3030
# templates. We will enable this check after we moved to c++17.
3131
#
32+
# -modernize-unary-static-assert: clang-tidy asks removing empty string in
33+
# static_assert(), the check is only applicable for c++17 and later code.
34+
# We will enable this check after we moved to c++17.
35+
#
3236
# -performance-move-const-arg: This warning requires the developer to
3337
# know/care more about the implementation details of types/functions than
3438
# should be necessary. For example, `A a; F(std::move(a));` will trigger a
@@ -93,6 +97,7 @@ Checks: >
9397
-modernize-use-nodiscard,
9498
-modernize-avoid-c-arrays,
9599
-modernize-type-traits,
100+
-modernize-unary-static-assert,
96101
-performance-move-const-arg,
97102
-performance-avoid-endl,
98103
-performance-enum-size,

generator/internal/mixin_utils.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ google::api::HttpRule ParseHttpRule(YAML::detail::iterator_value const& rule) {
6565
kv.second.Type() != YAML::NodeType::Scalar)
6666
continue;
6767

68-
std::string const rule_key =
69-
absl::AsciiStrToLower(kv.first.as<std::string>());
70-
std::string const rule_value = kv.second.as<std::string>();
68+
auto const rule_key = absl::AsciiStrToLower(kv.first.as<std::string>());
69+
auto const rule_value = kv.second.as<std::string>();
7170

7271
if (rule_key == "get") {
7372
http_rule.set_get(rule_value);
@@ -107,7 +106,7 @@ std::unordered_map<std::string, google::api::HttpRule> GetMixinHttpOverrides(
107106
auto const& selector = rule["selector"];
108107
if (selector.Type() != YAML::NodeType::Scalar) continue;
109108

110-
std::string const method_full_name = selector.as<std::string>();
109+
auto const method_full_name = selector.as<std::string>();
111110
google::api::HttpRule http_rule = ParseHttpRule(rule);
112111

113112
if (rule["additional_bindings"]) {
@@ -150,7 +149,7 @@ std::vector<std::string> GetMixinProtoPaths(YAML::Node const& service_config) {
150149
if (api.Type() != YAML::NodeType::Map) continue;
151150
auto const& name = api["name"];
152151
if (name.Type() != YAML::NodeType::Scalar) continue;
153-
std::string const package_path = name.as<std::string>();
152+
auto const package_path = name.as<std::string>();
154153
auto const& mixin_proto_path_map = GetMixinProtoPathMap();
155154
auto const it = mixin_proto_path_map.find(package_path);
156155
if (it == mixin_proto_path_map.end()) continue;

google/cloud/bigtable/row_reader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class RowReader {
8181
MetadataUpdatePolicy metadata_update_policy,
8282
std::unique_ptr<internal::ReadRowsParserFactory> parser_factory);
8383

84+
// NOLINTNEXTLINE(performance-noexcept-move-constructor)
8485
RowReader(RowReader&&) = default;
8586

8687
~RowReader() = default;

google/cloud/storage/async/reader.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class Discard : public std::enable_shared_from_this<Discard> {
5555

5656
} // namespace
5757

58+
// NOLINTNEXTLINE(bugprone-exception-escape)
5859
AsyncReader::~AsyncReader() {
5960
if (!impl_ || finished_) return;
6061
impl_->Cancel();

0 commit comments

Comments
 (0)