aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake
diff options
context:
space:
mode:
authorPaul Opiyo <59094545+paulopiyo777@users.noreply.github.com>2020-09-24 18:05:47 -0500
committerPaul Opiyo <59094545+paulopiyo777@users.noreply.github.com>2020-09-24 18:32:03 -0500
commit4d863a9fcb9460a9e4978466e03d2982d32e39f0 (patch)
tree9de85c5f857dff3ba76c332b23800343f884e2e7 /src/libexpr/flake
parent5a7fd38dbb0d0b3485c365486691cc018fb35575 (diff)
Remove redundant value checks
std::optional had redundant checks for whether it had a value. An object is emplaced either way so it can be dereferenced without repeating a value check
Diffstat (limited to 'src/libexpr/flake')
-rw-r--r--src/libexpr/flake/flake.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc
index 460eea5ea..760ed1a6e 100644
--- a/src/libexpr/flake/flake.cc
+++ b/src/libexpr/flake/flake.cc
@@ -48,17 +48,17 @@ static std::tuple<fetchers::Tree, FlakeRef, FlakeRef> fetchOrSubstituteTree(
resolvedRef = originalRef.resolve(state.store);
auto fetchedResolved = lookupInFlakeCache(flakeCache, originalRef);
if (!fetchedResolved) fetchedResolved.emplace(resolvedRef.fetchTree(state.store));
- flakeCache.push_back({resolvedRef, fetchedResolved.value()});
- fetched.emplace(fetchedResolved.value());
+ flakeCache.push_back({resolvedRef, *fetchedResolved});
+ fetched.emplace(*fetchedResolved);
}
else {
throw Error("'%s' is an indirect flake reference, but registry lookups are not allowed", originalRef);
}
}
- flakeCache.push_back({originalRef, fetched.value()});
+ flakeCache.push_back({originalRef, *fetched});
}
- auto [tree, lockedRef] = fetched.value();
+ auto [tree, lockedRef] = *fetched;
debug("got tree '%s' from '%s'",
state.store->printStorePath(tree.storePath), lockedRef);