From 0374b80dd407d7b35654a01e3c7526b749d3464e Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Fri, 23 Dec 2022 17:18:42 +0100 Subject: Just-MR: Remove wrong pass-by-reference when wrapping loggers Passing the logger by reference would require the caller to be kept alive. Also, being a shared_ptr, the logger can be passed by value at almost no cost. --- src/other_tools/root_maps/fpath_git_map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/other_tools/root_maps/fpath_git_map.cpp') diff --git a/src/other_tools/root_maps/fpath_git_map.cpp b/src/other_tools/root_maps/fpath_git_map.cpp index 25218368..e50afeb4 100644 --- a/src/other_tools/root_maps/fpath_git_map.cpp +++ b/src/other_tools/root_maps/fpath_git_map.cpp @@ -31,7 +31,7 @@ auto CreateFilePathGitMap( auto const& key) { // setup wrapped logger auto wrapped_logger = std::make_shared( - [&logger](auto const& msg, bool fatal) { + [logger](auto const& msg, bool fatal) { (*logger)( fmt::format("While getting repo root from path:\n{}", msg), fatal); @@ -91,7 +91,7 @@ auto CreateFilePathGitMap( // setup wrapped logger auto wrapped_logger = std::make_shared( - [&logger](auto const& msg, bool fatal) { + [logger](auto const& msg, bool fatal) { (*logger)( fmt::format("While getting subtree from " "path:\n{}", -- cgit v1.2.3