From f884ba240ea7ce948ce850c31f82bb2e9eac21b0 Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Sun, 14 Jan 2024 15:22:31 -0800 Subject: [PATCH] Remove unused variables in faiss/IndexHNSW.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: meyering Differential Revision: D52734573 fbshipit-source-id: edf315a4e2e7ddfaf8b879b7f4a3fc3a6c2e607f --- faiss/IndexHNSW.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/faiss/IndexHNSW.cpp b/faiss/IndexHNSW.cpp index c40136749b..9a67332d67 100644 --- a/faiss/IndexHNSW.cpp +++ b/faiss/IndexHNSW.cpp @@ -733,7 +733,6 @@ int search_from_candidates_2( int level, int nres_in = 0) { int nres = nres_in; - int ndis = 0; for (int i = 0; i < candidates.size(); i++) { idx_t v1 = candidates.ids[i]; FAISS_ASSERT(v1 >= 0); @@ -756,7 +755,6 @@ int search_from_candidates_2( if (vt.visited[v1] == vt.visno + 1) { // nothing to do } else { - ndis++; float d = qdis(v1); candidates.push(v1, d);