refactor(tvix): Prefer absl::StrFormat/StrAppend

This fmt call was particularly egregious

Change-Id: I2a3b1006c285170ab3374d1c8d81fc53e82a7b05
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2174
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
This commit is contained in:
Griffin Smith 2020-11-27 15:03:46 -05:00 committed by glittershark
parent bbfc47e96d
commit 5c3d58bb60

View file

@ -1463,15 +1463,22 @@ void DerivationGoal::tryToBuild() {
bool buildLocally = buildMode != bmNormal || parsedDrv->willBuildLocally(); bool buildLocally = buildMode != bmNormal || parsedDrv->willBuildLocally();
auto started = [&]() { auto started = [&]() {
auto msg = fmt(buildMode == bmRepair ? "repairing outputs of '%s'" std::string msg;
: buildMode == bmCheck ? "checking outputs of '%s'" if (buildMode == bmRepair) {
: nrRounds > 1 ? "building '%s' (round %d/%d)" msg = absl::StrFormat("repairing outputs of '%s'", drvPath);
: "building '%s'", } else if (buildMode == bmCheck) {
drvPath, curRound, nrRounds); msg = absl::StrFormat("checking outputs of '%s'", drvPath);
} else if (nrRounds > 1) {
msg = absl::StrFormat("building '%s' (round %d/%d)", drvPath, curRound,
nrRounds);
} else {
msg = absl::StrFormat("building '%s'", drvPath);
}
if (hook) { if (hook) {
msg += fmt(" on '%s'", machineName); absl::StrAppend(&msg, absl::StrFormat(" on '%s'", machineName));
} }
log_sink() << msg << std::endl; log_sink() << msg << std::endl;
mcRunningBuilds = mcRunningBuilds =
std::make_unique<MaintainCount<uint64_t>>(worker.runningBuilds); std::make_unique<MaintainCount<uint64_t>>(worker.runningBuilds);