summaryrefslogtreecommitdiff
path: root/test/test_helpers/envvar.cpp
diff options
context:
space:
mode:
authorGravatar Alexander Batischev <eual.jp@gmail.com> 2023-03-18 21:51:16 +0300
committerGravatar Alexander Batischev <eual.jp@gmail.com> 2023-03-18 21:51:16 +0300
commit53b9b3735c0b7a167035b7aa46086e1a37f0c166 (patch)
treed8c581dd866cf1c32eabac77e58881ed979d9d41 /test/test_helpers/envvar.cpp
parent674ff82c12f5addf99b1c91d7873b82d55c86e56 (diff)
downloadnewsboat-53b9b3735c0b7a167035b7aa46086e1a37f0c166.tar.gz
newsboat-53b9b3735c0b7a167035b7aa46086e1a37f0c166.tar.zst
newsboat-53b9b3735c0b7a167035b7aa46086e1a37f0c166.zip
Avoid passing `std::string` by value
This fixes a cppcheck warning. In test/test_helpers/envvar.cpp we still pass by value, but now it makes sense performance-wise because we're moving from it.
Diffstat (limited to '')
-rw-r--r--test/test_helpers/envvar.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/test_helpers/envvar.cpp b/test/test_helpers/envvar.cpp
index 7d44b486..9ef93920 100644
--- a/test/test_helpers/envvar.cpp
+++ b/test/test_helpers/envvar.cpp
@@ -3,11 +3,11 @@
#include "3rd-party/catch.hpp"
test_helpers::EnvVar::EnvVar(std::string name_)
- : EnvVar(name_, true)
+ : EnvVar(std::move(name_), true)
{
- if (name_ == "TZ") {
+ if (name == "TZ") {
throw std::invalid_argument("Using EnvVar(\"TZ\") is discouraged. Try test_helpers::TzEnvVar instead.");
- } else if (name_ == "LC_CTYPE") {
+ } else if (name == "LC_CTYPE") {
throw std::invalid_argument("Using EnvVar(\"LC_CTYPE\") is discouraged. Try test_helpers::LcCtypeEnvVar instead.");
}
}