Skip to content

Commit 63c3612

Browse files
generatedunixname89002005287564facebook-github-bot
generatedunixname89002005287564
authored andcommitted
Fix CQS signal. Id] 60881465 -- performance-unnecessary-value-param in fbcode/cachelib/common [A]
Reviewed By: haowu14 Differential Revision: D74699858 fbshipit-source-id: 2b7bd98956c1d13af18c1fe1256bb170ad0454ef
1 parent 7d9c045 commit 63c3612

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

cachelib/common/TestUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ constexpr uint64_t kDefaultTimeoutSecs = 30;
3636
* by calling this one.
3737
*/
3838
::testing::AssertionResult eventuallyTrue(
39-
std::function<::testing::AssertionResult(bool)> test,
39+
const std::function<::testing::AssertionResult(bool)>& test,
4040
uint64_t timeoutSecs) {
4141
constexpr uint64_t kMicrosPerSec = 1000000;
4242
const uint64_t timeoutUSec = timeoutSecs * kMicrosPerSec;

cachelib/common/Utils.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <folly/logging/xlog.h>
3131

3232
#include <numeric>
33+
#include <utility>
3334

3435
namespace facebook {
3536
namespace cachelib {
@@ -74,14 +75,14 @@ class CounterVisitor {
7475
}
7576

7677
void operator=(std::function<void(folly::StringPiece, double)> biFn) {
77-
biFn_ = biFn;
78+
biFn_ = std::move(biFn);
7879
triFn_ = nullptr;
7980
init();
8081
}
8182

8283
void operator=(
8384
std::function<void(folly::StringPiece, double, CounterType)> triFn) {
84-
triFn_ = triFn;
85+
triFn_ = std::move(triFn);
8586
biFn_ = nullptr;
8687
init();
8788
}
@@ -133,10 +134,10 @@ class StatsMap {
133134
}
134135

135136
// Insert a count stat
136-
void insertCount(std::string key, double val) { countMap[key] = val; }
137+
void insertCount(const std::string& key, double val) { countMap[key] = val; }
137138

138139
// Insert a rate stat
139-
void insertRate(std::string key, double val) { rateMap[key] = val; }
140+
void insertRate(const std::string& key, double val) { rateMap[key] = val; }
140141

141142
const std::unordered_map<std::string, double>& getCounts() const {
142143
return countMap;

0 commit comments

Comments
 (0)