Run cargo clippy --fix (#250)

* Run `cargo clippy --fix`
* Run `cargo clippy --all-features --fix`
* Fix other clippy warnings
* cargo fmt

Co-authored-by: Luis Moreno <morenol@users.noreply.github.com>
This commit is contained in:
morenol
2023-01-27 06:41:18 -04:00
committed by GitHub
parent 83dcf9a8ac
commit c7353d0b57
47 changed files with 146 additions and 222 deletions
+4 -8
View File
@@ -271,21 +271,18 @@ impl<TY: Number + Ord + Unsigned> BernoulliNBDistribution<TY> {
let y_samples = y.shape();
if y_samples != n_samples {
return Err(Failed::fit(&format!(
"Size of x should equal size of y; |x|=[{}], |y|=[{}]",
n_samples, y_samples
"Size of x should equal size of y; |x|=[{n_samples}], |y|=[{y_samples}]"
)));
}
if n_samples == 0 {
return Err(Failed::fit(&format!(
"Size of x and y should greater than 0; |x|=[{}]",
n_samples
"Size of x and y should greater than 0; |x|=[{n_samples}]"
)));
}
if alpha < 0f64 {
return Err(Failed::fit(&format!(
"Alpha should be greater than 0; |alpha|=[{}]",
alpha
"Alpha should be greater than 0; |alpha|=[{alpha}]"
)));
}
@@ -318,8 +315,7 @@ impl<TY: Number + Ord + Unsigned> BernoulliNBDistribution<TY> {
feature_in_class_counter[class_index][idx] +=
row_i.to_usize().ok_or_else(|| {
Failed::fit(&format!(
"Elements of the matrix should be 1.0 or 0.0 |found|=[{}]",
row_i
"Elements of the matrix should be 1.0 or 0.0 |found|=[{row_i}]"
))
})?;
}