chore(3p/nix): don't optional-wrap EvalState::file_access_trace_fn further

std::function has a natural null we can't eliminate anyway, so this was
effectively std::optional<std::optional<non_nullable_function>>.

Change-Id: If99f139146021edb25d133dad7f0f6e125ef53df
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1688
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
edef 2020-08-07 15:27:27 +00:00
parent 7db734afad
commit 3049f31d28
2 changed files with 3 additions and 4 deletions

View file

@ -1821,9 +1821,9 @@ void EvalState::printStats() {
} }
void EvalState::TraceFileAccess(const Path& realPath) { void EvalState::TraceFileAccess(const Path& realPath) {
if (file_access_trace_fn.has_value()) { if (file_access_trace_fn) {
if (last_traced_file != realPath) { if (last_traced_file != realPath) {
(*file_access_trace_fn)(realPath); file_access_trace_fn(realPath);
// Basic deduplication. // Basic deduplication.
last_traced_file = std::string(realPath); last_traced_file = std::string(realPath);
} }

View file

@ -303,8 +303,7 @@ class EvalState : public gc {
bool countCalls; bool countCalls;
std::optional<std::function<void(const Path&)>> file_access_trace_fn = std::function<void(const Path&)> file_access_trace_fn = nullptr;
std::nullopt;
Path last_traced_file = ""; Path last_traced_file = "";
typedef std::map<Symbol, size_t> PrimOpCalls; typedef std::map<Symbol, size_t> PrimOpCalls;