diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-09-30 21:31:21 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2021-09-30 21:35:09 +0000 |
commit | 242f9bf3dc04170502020fb0338b78ea76b9ebac (patch) | |
tree | d1d1e310e28b1b4b118aa81deee9a8e82b7abf0b /src/nix/log.cc | |
parent | 6a8d6246f603a372d557ab026670ae42bad558b0 (diff) |
`std::visit` by reference
I had started the trend of doing `std::visit` by value (because a type
error once mislead me into thinking that was the only form that
existed). While the optomizer in principle should be able to deal with
extra coppying or extra indirection once the lambdas inlined, sticking
with by reference is the conventional default. I hope this might even
improve performance.
Diffstat (limited to 'src/nix/log.cc')
-rw-r--r-- | src/nix/log.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nix/log.cc b/src/nix/log.cc index 962c47525..fd3c1d787 100644 --- a/src/nix/log.cc +++ b/src/nix/log.cc @@ -35,10 +35,10 @@ struct CmdLog : InstallableCommand RunPager pager; for (auto & sub : subs) { auto log = std::visit(overloaded { - [&](DerivedPath::Opaque bo) { + [&](const DerivedPath::Opaque & bo) { return sub->getBuildLog(bo.path); }, - [&](DerivedPath::Built bfd) { + [&](const DerivedPath::Built & bfd) { return sub->getBuildLog(bfd.drvPath); }, }, b.raw()); |