Skip to content

Commit 1544f2d

Browse files
nlutsenkometa-codesync[bot]
authored andcommitted
clang-format | Format fbsource with clang-format 21.
Reviewed By: ChristianK275 Differential Revision: D85317706 fbshipit-source-id: b399c5c4b75252999442b7d7d2778e7a241b0025
1 parent d97ec44 commit 1544f2d

37 files changed

+237
-196
lines changed

watchman/Client.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,9 @@ void UserClient::clientThread() noexcept {
489489
if ((*sub)->lastResponses.size() >= kResponseLogLimit) {
490490
(*sub)->lastResponses.pop_front();
491491
}
492-
(*sub)->lastResponses.push_back(ClientSubscription::LoggedResponse{
493-
std::chrono::system_clock::now(), response_to_send});
492+
(*sub)->lastResponses.push_back(
493+
ClientSubscription::LoggedResponse{
494+
std::chrono::system_clock::now(), response_to_send});
494495
}
495496
}
496497

watchman/Client.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ class Client : public std::enable_shared_from_this<Client> {
8181
fmt::format_string<T, Rest...> fmt,
8282
T&& arg,
8383
Rest&&... rest) {
84-
return sendErrorResponse(fmt::format(
85-
std::move(fmt), std::forward<T>(arg), std::forward<Rest>(rest)...));
84+
return sendErrorResponse(
85+
fmt::format(
86+
std::move(fmt), std::forward<T>(arg), std::forward<Rest>(rest)...));
8687
}
8788
};
8889

watchman/CommandRegistry.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ class ErrorResponse : public std::runtime_error {
3535
fmt::format_string<First, Rest...> fmt,
3636
First&& first,
3737
Rest&&... rest)
38-
: ErrorResponse(fmt::format(
39-
std::move(fmt),
40-
std::forward<First>(first),
41-
std::forward<Rest>(rest)...)
42-
.c_str()) {}
38+
: ErrorResponse(
39+
fmt::format(
40+
std::move(fmt),
41+
std::forward<First>(first),
42+
std::forward<Rest>(rest)...)
43+
.c_str()) {}
4344
};
4445

4546
/**
@@ -189,8 +190,10 @@ class TypedCommand : public CommandDefinition {
189190
}
190191

191192
using Request = typename T::Request;
192-
auto encodedResponse = serde::encode(T::handle(
193-
client, serde::decode<Request>(json_array(std::move(adjusted_args)))));
193+
auto encodedResponse = serde::encode(
194+
T::handle(
195+
client,
196+
serde::decode<Request>(json_array(std::move(adjusted_args)))));
194197
return UntypedResponse{encodedResponse.object()};
195198
}
196199
};

watchman/InMemoryView.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ void InMemoryFileResult::batchFetchProperties(
110110

111111
readlinkFutures.emplace_back(
112112
caches_.symlinkTargetCache.get(key).thenTry(
113-
[file](folly::Try<std::shared_ptr<
114-
const SymlinkTargetCache::Node>>&& result) {
113+
[file](
114+
folly::Try<std::shared_ptr<
115+
const SymlinkTargetCache::Node>>&& result) {
115116
if (result.hasValue()) {
116117
file->symlinkTarget_ = result.value()->value();
117118
} else {
@@ -141,8 +142,9 @@ void InMemoryFileResult::batchFetchProperties(
141142
file->file_->stat.mtime};
142143

143144
sha1Futures.emplace_back(caches_.contentHashCache.get(key).thenTry(
144-
[file](folly::Try<std::shared_ptr<const ContentHashCache::Node>>&&
145-
result) {
145+
[file](
146+
folly::Try<std::shared_ptr<const ContentHashCache::Node>>&&
147+
result) {
146148
file->contentSha1_ =
147149
makeResultWith([&] { return result.value()->value(); });
148150
}));
@@ -974,8 +976,9 @@ void InMemoryView::stopThreads(std::string_view reason) {
974976
auto pending = pendingFromWatcher_.lock();
975977
// we need this to make sure that watch does not hang
976978
for (auto& sync : pending->stealSyncs()) {
977-
sync.setException(std::runtime_error(
978-
fmt::format("Watch shutting down because ... {}", reason)));
979+
sync.setException(
980+
std::runtime_error(
981+
fmt::format("Watch shutting down because ... {}", reason)));
979982
}
980983
pending->startRefusingSyncs(reason);
981984
pending->ping();

watchman/LRUCache.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,14 @@ class LRUCache {
288288
: maxItems_(cfg.getInt(
289289
fmt::format("{}_cache_size", configPrefix).c_str(),
290290
defaultMaxItems)),
291-
errorTTL_(std::chrono::seconds(cfg.getInt(
292-
fmt::format("{}_cache_error_ttl_seconds", configPrefix).c_str(),
293-
errorTTLSeconds))),
294-
fetchTimeout_(std::chrono::seconds(cfg.getInt(
295-
fmt::format("{}_fetch_timeout_seconds", configPrefix).c_str(),
296-
fetchTimeoutSeconds))) {}
291+
errorTTL_(
292+
std::chrono::seconds(cfg.getInt(
293+
fmt::format("{}_cache_error_ttl_seconds", configPrefix).c_str(),
294+
errorTTLSeconds))),
295+
fetchTimeout_(
296+
std::chrono::seconds(cfg.getInt(
297+
fmt::format("{}_fetch_timeout_seconds", configPrefix).c_str(),
298+
fetchTimeoutSeconds))) {}
297299

298300
// No moving or copying
299301
LRUCache(const LRUCache&) = delete;

watchman/Logging.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ class Log {
5151

5252
auto payload = json_object(
5353
{{"log",
54-
typed_string_to_json(w_string::build(
55-
currentTimeString(timebuf, sizeof(timebuf)),
56-
": [",
57-
getThreadName(),
58-
"] ",
59-
std::forward<Args>(args)...))},
54+
typed_string_to_json(
55+
w_string::build(
56+
currentTimeString(timebuf, sizeof(timebuf)),
57+
": [",
58+
getThreadName(),
59+
"] ",
60+
std::forward<Args>(args)...))},
6061
{"unilateral", json_true()},
6162
{"level", typed_string_to_json(logLevelToLabel(level))}});
6263

@@ -79,12 +80,13 @@ class Log {
7980
fmt::format(fmt::runtime(format_str), std::forward<Args>(args)...);
8081
auto payload = json_object(
8182
{{"log",
82-
typed_string_to_json(w_string::build(
83-
currentTimeString(timebuf, sizeof(timebuf)),
84-
": [",
85-
getThreadName(),
86-
"] ",
87-
std::move(message)))},
83+
typed_string_to_json(
84+
w_string::build(
85+
currentTimeString(timebuf, sizeof(timebuf)),
86+
": [",
87+
getThreadName(),
88+
"] ",
89+
std::move(message)))},
8890
{"unilateral", json_true()},
8991
{"level", typed_string_to_json(logLevelToLabel(level))}});
9092

watchman/PDU.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,10 @@ std::optional<json_ref> PduBuffer::readBserPdu(
259259
ERR,
260260
"decoding BSER failed. The first KB of the hex representation of "
261261
"message follows:\n{:.1024}\n",
262-
folly::hexlify(folly::ByteRange{
263-
reinterpret_cast<const unsigned char*>(buf + rpos), wpos - rpos}));
262+
folly::hexlify(
263+
folly::ByteRange{
264+
reinterpret_cast<const unsigned char*>(buf + rpos),
265+
wpos - rpos}));
264266
*jerr = e.detail;
265267
}
266268

watchman/PathUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace watchman {
3232
void verify_dir_ownership(const std::string& state_dir) {
3333
#ifndef _WIN32
3434
// verify ownership
35-
struct stat st {};
35+
struct stat st{};
3636
int dir_fd;
3737
int ret = 0;
3838
uid_t euid = geteuid();

watchman/PendingCollection.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ void PendingChanges::startRefusingSyncs(std::string_view reason) {
9999

100100
void PendingChanges::addSync(folly::Promise<folly::Unit> promise) {
101101
if (refuseSyncs_) {
102-
promise.setException(std::runtime_error(fmt::format(
103-
"Watch is shutting down because ... {}", refuseSyncsReason_)));
102+
promise.setException(
103+
std::runtime_error(
104+
fmt::format(
105+
"Watch is shutting down because ... {}", refuseSyncsReason_)));
104106
return;
105107
}
106108
syncs_.push_back(std::move(promise));

watchman/SanityCheck.cpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,19 @@ void check_clock_command(watchman_stream* client, const json_ref& root) {
9595
json_object({{"sync_timeout", json_integer(20000)}})});
9696
auto res = buf.pduEncodeToStream(PduFormat{is_bser, 0}, cmd, client);
9797
if (res.hasError()) {
98-
throw std::runtime_error(fmt::format(
99-
"Failed to send clock PDU: {}", folly::errnoStr(res.error())));
98+
throw std::runtime_error(
99+
fmt::format(
100+
"Failed to send clock PDU: {}", folly::errnoStr(res.error())));
100101
}
101102

102103
buf.clear();
103104
auto result = decodeNext(client, buf, jerr);
104105
if (!result) {
105-
throw std::runtime_error(fmt::format(
106-
"Failed to decode clock response: {} {}",
107-
jerr.text,
108-
folly::errnoStr(errno)));
106+
throw std::runtime_error(
107+
fmt::format(
108+
"Failed to decode clock response: {} {}",
109+
jerr.text,
110+
folly::errnoStr(errno)));
109111
}
110112

111113
// Check for error in the response
@@ -132,17 +134,19 @@ json_ref get_watch_list(watchman_stream* client) {
132134

133135
auto res = buf.pduEncodeToStream(PduFormat{is_bser, 0}, cmd, client);
134136
if (res.hasError()) {
135-
throw std::runtime_error(fmt::format(
136-
"Failed to send watch-list PDU: {}", folly::errnoStr(res.error())));
137+
throw std::runtime_error(
138+
fmt::format(
139+
"Failed to send watch-list PDU: {}", folly::errnoStr(res.error())));
137140
}
138141

139142
buf.clear();
140143
auto result = decodeNext(client, buf, jerr);
141144
if (!result) {
142-
throw std::runtime_error(fmt::format(
143-
"Failed to decode watch-list response: {} error: {}",
144-
jerr.text,
145-
folly::errnoStr(errno)));
145+
throw std::runtime_error(
146+
fmt::format(
147+
"Failed to decode watch-list response: {} error: {}",
148+
jerr.text,
149+
folly::errnoStr(errno)));
146150
}
147151
return result->get("roots");
148152
}

0 commit comments

Comments
 (0)