Skip to content

Commit 53fc617

Browse files
r-barnesfacebook-github-bot
authored andcommitted
Remove unused variables in faiss/tests/test_threaded_index.cpp
Summary: LLVM-15 has a warning `-Wunused-but-set-variable` which we treat as an error because it's so often diagnostic of a code issue. Unused variables can compromise readability or, worse, performance. This diff either (a) removes an unused variable and, possibly, it's associated code, or (b) qualifies the variable with `[[maybe_unused]]`, mostly in cases where the variable _is_ used, but, eg, in an `assert` statement that isn't present in production code. - If you approve of this diff, please use the "Accept & Ship" button :-) Reviewed By: palmje Differential Revision: D53779512 fbshipit-source-id: 038967a05306d921cc09f48ae71b4e6d4eda6664
1 parent aaca1c2 commit 53fc617

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

tests/test_threaded_index.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ TEST(ThreadedIndex, TestReplica) {
169169
int k = 6;
170170

171171
// Try with threading and without
172-
for (bool threaded : {true, false}) {
172+
for ([[maybe_unused]] const bool threaded : {true, false}) {
173173
std::vector<std::unique_ptr<MockIndex>> idxs;
174174
faiss::IndexReplicas replica(d);
175175

@@ -247,8 +247,6 @@ TEST(ThreadedIndex, TestShards) {
247247
shards.search(n, x.data(), k, distances.data(), labels.data());
248248

249249
for (int i = 0; i < idxs.size(); ++i) {
250-
auto perShard = n / idxs.size();
251-
252250
EXPECT_EQ(idxs[i]->nCalled, n);
253251
EXPECT_EQ(idxs[i]->xCalled, x.data());
254252
EXPECT_EQ(idxs[i]->kCalled, k);

0 commit comments

Comments
 (0)