Skip to content

Commit

Permalink
Merge pull request #78 from Enet4/chore/lint-fix
Browse files Browse the repository at this point in the history
Reorganize imports & Clippy-fix
  • Loading branch information
Enet4 authored Mar 27, 2024
2 parents 358f4cd + bbd63f9 commit 3cc97ff
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 29 deletions.
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

0 comments on commit 3cc97ff

Please sign in to comment.