diff options
author | Vincent Ambo <mail@tazj.in> | 2020-08-21T03·00+0100 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2020-08-23T11·58+0000 |
commit | 1cf11317cac2c11d20b2324d4283814f1351c1a3 (patch) | |
tree | 5a77610f94b0b8fd60bf64c1ca765b05ab8a6fd6 /third_party/nix/src/libstore/http-binary-cache-store.cc | |
parent | 1443298657156107704b5d9fcfa7356ee8fa8789 (diff) |
refactor(tvix/libutil): Mark single-argument constructors explicit r/1704
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>
Diffstat (limited to 'third_party/nix/src/libstore/http-binary-cache-store.cc')
-rw-r--r-- | third_party/nix/src/libstore/http-binary-cache-store.cc | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/third_party/nix/src/libstore/http-binary-cache-store.cc b/third_party/nix/src/libstore/http-binary-cache-store.cc index 8ab07033b191..c713ac43c47a 100644 --- a/third_party/nix/src/libstore/http-binary-cache-store.cc +++ b/third_party/nix/src/libstore/http-binary-cache-store.cc @@ -135,20 +135,22 @@ class HttpBinaryCacheStore : public BinaryCacheStore { std::make_shared<decltype(callback)>(std::move(callback)); getDownloader()->enqueueDownload( - request, {[callbackPtr, this](std::future<DownloadResult> result) { - try { - (*callbackPtr)(result.get().data); - } catch (DownloadError& e) { - if (e.error == Downloader::NotFound || - e.error == Downloader::Forbidden) { - return (*callbackPtr)(std::shared_ptr<std::string>()); - } - maybeDisable(); - callbackPtr->rethrow(); - } catch (...) { - callbackPtr->rethrow(); - } - }}); + request, + Callback<DownloadResult>{ + [callbackPtr, this](std::future<DownloadResult> result) { + try { + (*callbackPtr)(result.get().data); + } catch (DownloadError& e) { + if (e.error == Downloader::NotFound || + e.error == Downloader::Forbidden) { + return (*callbackPtr)(std::shared_ptr<std::string>()); + } + maybeDisable(); + callbackPtr->rethrow(); + } catch (...) { + callbackPtr->rethrow(); + } + }}); } }; |