refactor(tvix/libutil): Mark single-argument constructors explicit
This is the clang-tidy lint 'google-explicit-constructor'. There's a whole bunch of breakage that was introduced by this, and we had to opt out a few types of this (esp. the string formatting crap). In some cases minor other changes have been done to keep the code working, instead of converting between types (e.g. an explicit comparison operator implementation for nix::Pid). Change-Id: I12e1ca51a6bc2c882dba81a2526b9729d26988e7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1832 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
parent
1443298657
commit
1cf11317ca
34 changed files with 309 additions and 272 deletions
|
|
@ -80,13 +80,14 @@ void BinaryCacheStore::getFile(
|
|||
|
||||
void BinaryCacheStore::getFile(const std::string& path, Sink& sink) {
|
||||
std::promise<std::shared_ptr<std::string>> promise;
|
||||
getFile(path, {[&](std::future<std::shared_ptr<std::string>> result) {
|
||||
try {
|
||||
promise.set_value(result.get());
|
||||
} catch (...) {
|
||||
promise.set_exception(std::current_exception());
|
||||
}
|
||||
}});
|
||||
getFile(path, Callback<std::shared_ptr<std::string>>{
|
||||
[&](std::future<std::shared_ptr<std::string>> result) {
|
||||
try {
|
||||
promise.set_value(result.get());
|
||||
} catch (...) {
|
||||
promise.set_exception(std::current_exception());
|
||||
}
|
||||
}});
|
||||
auto data = promise.get_future().get();
|
||||
sink(reinterpret_cast<unsigned char*>(data->data()), data->size());
|
||||
}
|
||||
|
|
@ -280,23 +281,25 @@ void BinaryCacheStore::queryPathInfoUncached(
|
|||
|
||||
auto callbackPtr = std::make_shared<decltype(callback)>(std::move(callback));
|
||||
|
||||
getFile(narInfoFile, {[=](std::future<std::shared_ptr<std::string>> fut) {
|
||||
try {
|
||||
auto data = fut.get();
|
||||
getFile(narInfoFile,
|
||||
Callback<std::shared_ptr<std::string>>(
|
||||
[=](std::future<std::shared_ptr<std::string>> fut) {
|
||||
try {
|
||||
auto data = fut.get();
|
||||
|
||||
if (!data) {
|
||||
return (*callbackPtr)(nullptr);
|
||||
}
|
||||
if (!data) {
|
||||
return (*callbackPtr)(nullptr);
|
||||
}
|
||||
|
||||
stats.narInfoRead++;
|
||||
stats.narInfoRead++;
|
||||
|
||||
(*callbackPtr)(std::shared_ptr<ValidPathInfo>(
|
||||
std::make_shared<NarInfo>(*this, *data, narInfoFile)));
|
||||
(*callbackPtr)(std::shared_ptr<ValidPathInfo>(
|
||||
std::make_shared<NarInfo>(*this, *data, narInfoFile)));
|
||||
|
||||
} catch (...) {
|
||||
callbackPtr->rethrow();
|
||||
}
|
||||
}});
|
||||
} catch (...) {
|
||||
callbackPtr->rethrow();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
Path BinaryCacheStore::addToStore(const std::string& name, const Path& srcPath,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue