From e55a0ac5b579851daf8cea16ff3002ab739af214 Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Tue, 23 Jan 2024 04:40:52 -0800 Subject: [PATCH] Remove unused variables in faiss/impl/index_write.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: algoriddle Differential Revision: D52981052 fbshipit-source-id: 203e7ead56c69ffd77ee4a61eed1d0a502a14866 --- faiss/impl/index_write.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/faiss/impl/index_write.cpp b/faiss/impl/index_write.cpp index 7bb302700d..b2808d7170 100644 --- a/faiss/impl/index_write.cpp +++ b/faiss/impl/index_write.cpp @@ -338,13 +338,11 @@ static void write_NSG(const NSG* nsg, IOWriter* f) { FAISS_THROW_IF_NOT(K == nsg->R); FAISS_THROW_IF_NOT(true == graph->own_fields); - int size = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < K; j++) { int id = graph->at(i, j); if (id != EMPTY_ID) { WRITE1(id); - size += 1; } else { break; }