Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize imports & Clippy-fix #78

Merged
merged 3 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ impl Clustering {
* Perform the clustering algorithm with the given data and index.
* The index is used during the assignment stage.
*/
pub fn train<I: ?Sized>(&mut self, x: &[f32], index: &mut I) -> Result<()>
pub fn train<I>(&mut self, x: &[f32], index: &mut I) -> Result<()>
where
I: NativeIndex,
I: ?Sized + NativeIndex,
{
unsafe {
let n = x.len() / self.d() as usize;
Expand Down
6 changes: 1 addition & 5 deletions src/index/autotune.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
use std::ffi;
use std::ptr;

use super::*;

use crate::error::{Error, Result};
use crate::faiss_try;

/// Uses a-priori knowledge on the Faiss indexes to extract tunable parameters.
pub struct ParameterSpace {
inner: *mut FaissParameterSpace,
Expand Down Expand Up @@ -67,7 +63,7 @@ impl Drop for ParameterSpace {

#[cfg(test)]
mod tests {
use super::*;
use crate::index::autotune::ParameterSpace;
use crate::index::index_factory;
use crate::metric::MetricType;

Expand Down
5 changes: 0 additions & 5 deletions src/index/flat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

use super::*;

use crate::error::{Error, Result};
use crate::faiss_try;
use std::mem;
use std::ptr;

/// Alias for the native implementation of a flat index.
pub type FlatIndex = FlatIndexImpl;

Expand Down
4 changes: 0 additions & 4 deletions src/index/ivf_flat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

use super::*;

use crate::error::Result;
use crate::faiss_try;
use std::mem;
use std::os::raw::{c_char, c_int};
use std::ptr;

/// Alias for the native implementation of a flat index.
pub type IVFFlatIndex = IVFFlatIndexImpl;
Expand Down
7 changes: 2 additions & 5 deletions src/index/pretransform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

use super::*;

use crate::error::{Error, Result};
use crate::faiss_try;
use crate::vector_transform::NativeVectorTransform;
use std::marker::PhantomData;
use std::mem;
use std::os::raw::c_int;
use std::ptr;

/// Alias for the native implementation of a PreTransform index.
pub type PreTransformIndex<I> = PreTransformIndexImpl<I>;
Expand Down Expand Up @@ -298,7 +294,8 @@ where

#[cfg(test)]
mod tests {
use super::*;
use crate::index::pretransform::PreTransformIndexImpl;
use crate::index::UpcastIndex as _;
use crate::metric::MetricType;
use crate::{
index::{index_factory, ConcurrentIndex, Idx, Index},
Expand Down
4 changes: 0 additions & 4 deletions src/index/refine_flat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

use super::*;

use crate::error::Result;
use crate::faiss_try;
use std::marker::PhantomData;
use std::mem;
use std::os::raw::c_int;
use std::ptr;

/// Alias for the native implementation of a index.
pub type RefineFlatIndex<BI> = RefineFlatIndexImpl<BI>;
Expand Down
4 changes: 0 additions & 4 deletions src/index/scalar_quantizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

use super::*;

use crate::error::Result;
use crate::faiss_try;
use std::marker::PhantomData;
use std::mem;
use std::os::raw::c_int;
use std::ptr;

/// Alias for the native implementation of a scalar quantizer index.
pub type ScalarQuantizerIndex = ScalarQuantizerIndexImpl;
Expand Down
Loading