Skip to content

Commit 8d5f8d1

Browse files
committed
ClangTidy issue in lib/system/Route.hpp #1296
1 parent 5116b27 commit 8d5f8d1

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

lib/offline/StorageObserver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace MAT_NS_BEGIN {
4545
{
4646
auto consumer = [&ctx, this](StorageRecord&& record) -> bool {
4747
bool wantMore = true;
48-
retrievedEvent(ctx, std::move(record), wantMore);
48+
retrievedEvent(ctx, record, wantMore);
4949
return wantMore;
5050
};
5151

lib/system/Route.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ namespace MAT_NS_BEGIN {
9999
}
100100

101101
template<typename... TRealArgs>
102-
void operator()(TRealArgs&& ... args) const
102+
void operator()(TRealArgs ... args) const
103103
{
104104
for (IRoutePassThrough<TArgs...>* target : m_passthroughs) {
105-
if (!(*target)(std::forward<TRealArgs>(args) ...)) {
105+
if (!(*target)(args ...)) {
106106
return;
107107
}
108108
}
109109
if (m_target) {
110-
(*m_target)(std::forward<TRealArgs>(args) ...);
110+
(*m_target)(args ...);
111111
}
112112
}
113113

tests/unittests/RouteTests.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,16 @@ class RouteTests : public StrictMock<Test> {
6464
RouteSink<RouteTests, int> sink1{this, &RouteTests::handleSink1};
6565
RoutePassThrough<RouteTests, int> passThrough1a{this, &RouteTests::handlePassThrough1a};
6666
RoutePassThrough<RouteTests, int> passThrough1b{this, &RouteTests::handlePassThrough1b};
67-
RouteSink<RouteTests, int, bool&, NonCopyableThing const&, Canary, std::vector<int>&&> sink5{this, &RouteTests::handleSink5x};
67+
RouteSink<RouteTests, int, bool&, NonCopyableThing const&, Canary, std::vector<int>&> sink5{this, &RouteTests::handleSink5x};
6868

6969
MOCK_METHOD0(handleSink0, void());
7070
MOCK_METHOD1(handleSink1, void(int));
7171
MOCK_METHOD1(handlePassThrough1a, bool(int));
7272
MOCK_METHOD1(handlePassThrough1b, bool(int));
7373
MOCK_METHOD4(handleSink5, void(int, bool&, NonCopyableThing const &, Canary));
7474

75-
void handleSink5x(int a, bool& b, NonCopyableThing const& c, Canary d, std::vector<int>&& e)
75+
void handleSink5x(int a, bool& b, NonCopyableThing const& c, Canary d, std::vector<int>& e)
7676
{
77-
// This extra function exists just to handle the r-value reference.
78-
// The move cannot be done properly in a mocked method.
79-
std::vector<int> x = std::move(e);
8077
handleSink5(a, b, c, d);
8178
}
8279
};
@@ -99,7 +96,7 @@ TEST_F(RouteTests, SinkPassesArgsAsDefined)
9996
SetArgReferee<1>(true),
10097
InvokeArgument<3>()
10198
));
102-
sink5(123, flag, thing, canary, std::move(data));
99+
sink5(123, flag, thing, canary, data);
103100

104101
EXPECT_THAT(flag, true);
105102
EXPECT_THAT(canary, Eq("alive"));
@@ -117,7 +114,7 @@ TEST_F(RouteTests, SourceCallsSink)
117114
RouteSource<> source0;
118115
source0 >> sink0;
119116

120-
RouteSource<int, bool&, NonCopyableThing const&, Canary, std::vector<int>&&> source5;
117+
RouteSource<int, bool&, NonCopyableThing const&, Canary, std::vector<int>&> source5;
121118
source5 >> sink5;
122119

123120

@@ -137,7 +134,7 @@ TEST_F(RouteTests, SourceCallsSink)
137134
SetArgReferee<1>(true),
138135
InvokeArgument<3>()
139136
));
140-
source5(123, flag, thing, canary, std::move(data));
137+
source5(123, flag, thing, canary, data);
141138
EXPECT_THAT(flag, true);
142139
EXPECT_THAT(canary, Eq("alive"));
143140
EXPECT_THAT(data, IsEmpty());

0 commit comments

Comments
 (0)