From 145d88cb2a160871968285fb1898732090f4e14c Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 19 Jun 2020 14:58:30 +0000 Subject: [PATCH] Use designated initializers for `DerivationOutputHash` --- src/libexpr/primops.cc | 5 ++++- src/libstore/derivations.cc | 8 ++++---- src/libstore/derivations.hh | 3 --- src/nix/develop.cc | 3 ++- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 175fccf39..bf3c17997 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -776,7 +776,10 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * if (!jsonObject) drv.env["out"] = state.store->printStorePath(outPath); drv.outputs.insert_or_assign("out", DerivationOutput { .path = std::move(outPath), - .hash = DerivationOutputHash { ingestionMethod, std::move(h) }, + .hash = DerivationOutputHash { + .method = ingestionMethod, + .hash = std::move(h), + }, }); } diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index 51a01feac..528b7ccea 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -124,8 +124,8 @@ static DerivationOutput parseDerivationOutput(const Store & store, istringstream if (hashType == htUnknown) throw Error("unknown hash hashAlgorithm '%s'", hashAlgo); fsh = DerivationOutputHash { - std::move(method), - Hash(hash, hashType), + .method = std::move(method), + .hash = Hash(hash, hashType), }; } @@ -424,8 +424,8 @@ static DerivationOutput readDerivationOutput(Source & in, const Store & store) if (hashType == htUnknown) throw Error("unknown hash hashAlgorithm '%s'", hashAlgo); fsh = DerivationOutputHash { - std::move(method), - Hash(hash, hashType), + .method = std::move(method), + .hash = Hash(hash, hashType), }; } diff --git a/src/libstore/derivations.hh b/src/libstore/derivations.hh index f3eff2748..292861065 100644 --- a/src/libstore/derivations.hh +++ b/src/libstore/derivations.hh @@ -20,9 +20,6 @@ struct DerivationOutputHash { : method(std::move(method)) , hash(std::move(hash)) { } - DerivationOutputHash(const DerivationOutputHash &) = default; - DerivationOutputHash(DerivationOutputHash &&) = default; - DerivationOutputHash & operator = (const DerivationOutputHash &) = default; std::string printMethodAlgo() const; }; diff --git a/src/nix/develop.cc b/src/nix/develop.cc index 0845c65fa..8b85caf82 100644 --- a/src/nix/develop.cc +++ b/src/nix/develop.cc @@ -138,7 +138,8 @@ StorePath getDerivationEnvironment(ref store, const StorePath & drvPath) drv.outputs.insert_or_assign("out", DerivationOutput { .path = shellOutPath, .hash = DerivationOutputHash { - FileIngestionMethod::Flat, Hash { } + .method = FileIngestionMethod::Flat, + .hash = Hash { }, }, }); drv.env["out"] = store->printStorePath(shellOutPath);