about summary refs log tree commit diff
path: root/third_party/nix
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2020-08-07T15·27+0000
committeredef <edef@edef.eu>2020-08-08T18·01+0000
commit3049f31d2824b95c8a2e13c6b919847de6bd0705 (patch)
treeff2be51f6bfff43e0e3e51ca78b186feea3e5f1a /third_party/nix
parent7db734afad313b8669623138130797fad797daa7 (diff)
chore(3p/nix): don't optional-wrap EvalState::file_access_trace_fn further r/1616
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>
Diffstat (limited to 'third_party/nix')
-rw-r--r--third_party/nix/src/libexpr/eval.cc4
-rw-r--r--third_party/nix/src/libexpr/eval.hh3
2 files changed, 3 insertions, 4 deletions
diff --git a/third_party/nix/src/libexpr/eval.cc b/third_party/nix/src/libexpr/eval.cc
index f068b6ba6a48..3ecd990daaac 100644
--- a/third_party/nix/src/libexpr/eval.cc
+++ b/third_party/nix/src/libexpr/eval.cc
@@ -1821,9 +1821,9 @@ void EvalState::printStats() {
 }
 
 void EvalState::TraceFileAccess(const Path& realPath) {
-  if (file_access_trace_fn.has_value()) {
+  if (file_access_trace_fn) {
     if (last_traced_file != realPath) {
-      (*file_access_trace_fn)(realPath);
+      file_access_trace_fn(realPath);
       // Basic deduplication.
       last_traced_file = std::string(realPath);
     }
diff --git a/third_party/nix/src/libexpr/eval.hh b/third_party/nix/src/libexpr/eval.hh
index c244b6eecc73..d2ff99c9fc13 100644
--- a/third_party/nix/src/libexpr/eval.hh
+++ b/third_party/nix/src/libexpr/eval.hh
@@ -303,8 +303,7 @@ class EvalState : public gc {
 
   bool countCalls;
 
-  std::optional<std::function<void(const Path&)>> file_access_trace_fn =
-      std::nullopt;
+  std::function<void(const Path&)> file_access_trace_fn = nullptr;
   Path last_traced_file = "";
 
   typedef std::map<Symbol, size_t> PrimOpCalls;