Merge pull request #9172 from tfc/bad-moves

Fix/remove some bad std::moves
This commit is contained in:
John Ericson 2023-10-16 17:46:41 -04:00 committed by GitHub
commit 8c049a9f04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 8 deletions

View file

@ -539,7 +539,7 @@ EvalState::EvalState(
auto r = resolveSearchPathPath(i.path); auto r = resolveSearchPathPath(i.path);
if (!r) continue; if (!r) continue;
auto path = *std::move(r); auto path = std::move(*r);
if (store->isInStore(path)) { if (store->isInStore(path)) {
try { try {
@ -1035,7 +1035,7 @@ std::string EvalState::mkOutputStringRaw(
/* In practice, this is testing for the case of CA derivations, or /* In practice, this is testing for the case of CA derivations, or
dynamic derivations. */ dynamic derivations. */
return optStaticOutputPath return optStaticOutputPath
? store->printStorePath(*std::move(optStaticOutputPath)) ? store->printStorePath(std::move(*optStaticOutputPath))
/* Downstream we would substitute this for an actual path once /* Downstream we would substitute this for an actual path once
we build the floating CA derivation */ we build the floating CA derivation */
: DownstreamPlaceholder::fromSingleDerivedPathBuilt(b, xpSettings).render(); : DownstreamPlaceholder::fromSingleDerivedPathBuilt(b, xpSettings).render();
@ -2290,7 +2290,7 @@ BackedStringView EvalState::coerceToString(
&& (!v2->isList() || v2->listSize() != 0)) && (!v2->isList() || v2->listSize() != 0))
result += " "; result += " ";
} }
return std::move(result); return result;
} }
} }

View file

@ -4,7 +4,7 @@ namespace nix {
SourcePath EvalState::rootPath(CanonPath path) SourcePath EvalState::rootPath(CanonPath path)
{ {
return std::move(path); return path;
} }
} }

View file

@ -561,7 +561,7 @@ void DerivationGoal::inputsRealised()
attempt = fullDrv.tryResolve(worker.store); attempt = fullDrv.tryResolve(worker.store);
} }
assert(attempt); assert(attempt);
Derivation drvResolved { *std::move(attempt) }; Derivation drvResolved { std::move(*attempt) };
auto pathResolved = writeDerivation(worker.store, drvResolved); auto pathResolved = writeDerivation(worker.store, drvResolved);

View file

@ -2521,7 +2521,7 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
ValidPathInfo newInfo0 { ValidPathInfo newInfo0 {
worker.store, worker.store,
outputPathName(drv->name, outputName), outputPathName(drv->name, outputName),
*std::move(optCA), std::move(*optCA),
Hash::dummy, Hash::dummy,
}; };
if (*scratchPath != newInfo0.path) { if (*scratchPath != newInfo0.path) {

View file

@ -83,7 +83,7 @@ static std::pair<ContentAddressMethod, HashType> parseContentAddressMethodPrefix
if (!hashTypeRaw) if (!hashTypeRaw)
throw UsageError("content address hash must be in form '<algo>:<hash>', but found: %s", wholeInput); throw UsageError("content address hash must be in form '<algo>:<hash>', but found: %s", wholeInput);
HashType hashType = parseHashType(*hashTypeRaw); HashType hashType = parseHashType(*hashTypeRaw);
return std::move(hashType); return hashType;
}; };
// Switch on prefix // Switch on prefix

View file

@ -63,7 +63,7 @@ std::optional<std::pair<std::string_view, ExtendedOutputsSpec>> ExtendedOutputsS
auto specOpt = OutputsSpec::parseOpt(s.substr(found + 1)); auto specOpt = OutputsSpec::parseOpt(s.substr(found + 1));
if (!specOpt) if (!specOpt)
return std::nullopt; return std::nullopt;
return std::pair { s.substr(0, found), ExtendedOutputsSpec::Explicit { *std::move(specOpt) } }; return std::pair { s.substr(0, found), ExtendedOutputsSpec::Explicit { std::move(*specOpt) } };
} }