Skip to content

Commit 2c550b4

Browse files
fboss2 bgp config: address clang-tidy findings
- Use auto for the SimpleJSONSerializer template-cast result in ConfigSession::saveBgpConfig() (modernize-use-auto). - Drop redundant .c_str() on the TEnumTraits::findValue() argument in the neighbor enum attribute handler (readability-redundant-string-cstr).
1 parent 66df523 commit 2c550b4

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

fboss/cli/fboss2/commands/config/protocol/bgp/neighbor/CmdConfigProtocolBgpNeighbor.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,7 @@ AttrHandler enumAttr(
233233
mode = static_cast<EnumT>(*enable ? 1 : 0);
234234
valid = true;
235235
} else {
236-
valid = apache::thrift::TEnumTraits<EnumT>::findValue(
237-
values[0].c_str(), &mode);
236+
valid = apache::thrift::TEnumTraits<EnumT>::findValue(values[0], &mode);
238237
}
239238
if (!valid) {
240239
std::string names;

fboss/cli/fboss2/session/ConfigSession.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ void ConfigSession::saveBgpConfig() {
592592

593593
// Serialize the entire typed config (round-tripped through parse so integer
594594
// map keys become string keys, mirroring saveConfig() for the agent).
595-
std::string json =
595+
auto json =
596596
apache::thrift::SimpleJSONSerializer::serialize<std::string>(bgpConfig_);
597597
std::string prettyJson = folly::toPrettyJson(folly::parseJson(json));
598598
folly::writeFileAtomic(

0 commit comments

Comments
 (0)