Fix clippy errors
This commit is contained in:
@@ -101,7 +101,7 @@ impl<T: Debug + PartialEq, F: RealNumber, D: Distance<T, F>> CoverTree<T, F, D>
|
||||
/// * `p` - look for k nearest points to `p`
|
||||
/// * `k` - the number of nearest neighbors to return
|
||||
pub fn find(&self, p: &T, k: usize) -> Result<Vec<(usize, F, &T)>, Failed> {
|
||||
if k <= 0 {
|
||||
if k == 0 {
|
||||
return Err(Failed::because(FailedError::FindFailed, "k should be > 0"));
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ impl<T: RealNumber + Sum> KMeans<T> {
|
||||
return Err(Failed::fit(&format!("invalid number of clusters: {}", k)));
|
||||
}
|
||||
|
||||
if parameters.max_iter <= 0 {
|
||||
if parameters.max_iter == 0 {
|
||||
return Err(Failed::fit(&format!(
|
||||
"invalid maximum number of iterations: {}",
|
||||
parameters.max_iter
|
||||
|
||||
+2
-2
@@ -56,8 +56,8 @@ pub(crate) fn serialize_data<X: RealNumber, Y: RealNumber>(
|
||||
) -> Result<(), io::Error> {
|
||||
match File::create(filename) {
|
||||
Ok(mut file) => {
|
||||
file.write(&dataset.num_features.to_le_bytes())?;
|
||||
file.write(&dataset.num_samples.to_le_bytes())?;
|
||||
file.write_all(&dataset.num_features.to_le_bytes())?;
|
||||
file.write_all(&dataset.num_samples.to_le_bytes())?;
|
||||
let x: Vec<u8> = dataset
|
||||
.data
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user