Add anomaly and hst #42
Annotations
2 errors and 18 warnings
useless lint attribute:
src/main.rs#L11
error: useless lint attribute
--> src/main.rs:11:1
|
11 | #[allow(dead_code)]
| ^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(dead_code)]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_attribute
= note: `#[deny(clippy::useless_attribute)]` on by default
|
clippy_check
Clippy had exited with the 101 exit code
|
name `HST` contains a capitalized acronym:
src/main.rs#L34
warning: name `HST` contains a capitalized acronym
--> src/main.rs:34:8
|
34 | struct HST {
| ^^^ help: consider making the acronym lowercase, except the initial letter: `Hst`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms
= note: `#[warn(clippy::upper_case_acronyms)]` on by default
|
using `clone` on type `F` which implements the `Copy` trait:
src/metrics/confusion.rs#L150
warning: using `clone` on type `F` which implements the `Copy` trait
--> src/metrics/confusion.rs:150:9
|
150 | / self.data
151 | | .get(label)
152 | | .unwrap_or(&HashMap::new())
153 | | .get(label)
154 | | .unwrap_or(&F::zero())
155 | | .clone()
| |____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
help: try dereferencing it
|
150 ~ *self.data
151 + .get(label)
152 + .unwrap_or(&HashMap::new())
153 + .get(label)
154 + .unwrap_or(&F::zero())
|
|
using `clone` on type `F` which implements the `Copy` trait:
src/metrics/confusion.rs#L146
warning: using `clone` on type `F` which implements the `Copy` trait
--> src/metrics/confusion.rs:146:9
|
146 | self.sum_col.get(label).unwrap_or(&F::zero()).clone()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*self.sum_col.get(label).unwrap_or(&F::zero())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
= note: `#[warn(clippy::clone_on_copy)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/metrics/accuracy.rs#L60
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/metrics/accuracy.rs:60:52
|
60 | .max_by(|a, b| a.1.partial_cmp(&b.1).unwrap())
| ^^^^ help: change this to: `b.1`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/metrics/accuracy.rs#L37
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/metrics/accuracy.rs:37:52
|
37 | .max_by(|a, b| a.1.partial_cmp(&b.1).unwrap())
| ^^^^ help: change this to: `b.1`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/common.rs#L218
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/common.rs:218:52
|
218 | .max_by(|a, b| a.1.partial_cmp(&b.1).unwrap())
| ^^^^ help: change this to: `b.1`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
method `from_iter` can be confused for the standard trait method `std::iter::FromIterator::from_iter`:
src/common.rs#L77
warning: method `from_iter` can be confused for the standard trait method `std::iter::FromIterator::from_iter`
--> src/common.rs:77:5
|
77 | / pub fn from_iter<I: IntoClassifierTargetIter>(iter: I) -> Box<dyn Iterator<Item = Self>> {
78 | | iter.into_classifier_target_iter()
79 | | }
| |_____^
|
= help: consider implementing the trait `std::iter::FromIterator` or choosing a less ambiguous method name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
= note: `#[warn(clippy::should_implement_trait)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/anomaly/half_space_tree.rs#L119
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/anomaly/half_space_tree.rs:119:17
|
119 | &self.features.as_ref().unwrap(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `self.features.as_ref().unwrap()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
|
unneeded `return` statement:
src/anomaly/half_space_tree.rs#L192
warning: unneeded `return` statement
--> src/anomaly/half_space_tree.rs:192:9
|
192 | return None;
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
|
192 - return None;
192 + None
|
|
manual implementation of `Option::map`:
src/anomaly/half_space_tree.rs#L88
warning: manual implementation of `Option::map`
--> src/anomaly/half_space_tree.rs:88:21
|
88 | let trees = if let Some(features) = features {
| _____________________^
89 | | Some(Trees::new(n_trees, height, &features, &mut rng))
90 | | } else {
91 | | None
92 | | };
| |_________^ help: try this: `features.map(|features| Trees::new(n_trees, height, &features, &mut rng))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
= note: `#[warn(clippy::manual_map)]` on by default
|
redundant field names in struct initialization:
src/anomaly/half_space_tree.rs#L102
warning: redundant field names in struct initialization
--> src/anomaly/half_space_tree.rs:102:13
|
102 | trees: trees,
| ^^^^^^^^^^^^ help: replace it with: `trees`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
|
redundant field names in struct initialization:
src/anomaly/half_space_tree.rs#L101
warning: redundant field names in struct initialization
--> src/anomaly/half_space_tree.rs:101:13
|
101 | n_nodes: n_nodes,
| ^^^^^^^^^^^^^^^^ help: replace it with: `n_nodes`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
|
redundant field names in struct initialization:
src/anomaly/half_space_tree.rs#L100
warning: redundant field names in struct initialization
--> src/anomaly/half_space_tree.rs:100:13
|
100 | n_branches: n_branches,
| ^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `n_branches`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
|
redundant field names in struct initialization:
src/anomaly/half_space_tree.rs#L99
warning: redundant field names in struct initialization
--> src/anomaly/half_space_tree.rs:99:13
|
99 | rng: rng,
| ^^^^^^^^ help: replace it with: `rng`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
|
redundant field names in struct initialization:
src/anomaly/half_space_tree.rs#L97
warning: redundant field names in struct initialization
--> src/anomaly/half_space_tree.rs:97:13
|
97 | height: height,
| ^^^^^^^^^^^^^^ help: replace it with: `height`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
|
redundant field names in struct initialization:
src/anomaly/half_space_tree.rs#L96
warning: redundant field names in struct initialization
--> src/anomaly/half_space_tree.rs:96:13
|
96 | n_trees: n_trees,
| ^^^^^^^^^^^^^^^^ help: replace it with: `n_trees`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
|
redundant field names in struct initialization:
src/anomaly/half_space_tree.rs#L94
warning: redundant field names in struct initialization
--> src/anomaly/half_space_tree.rs:94:13
|
94 | window_size: window_size,
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `window_size`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
= note: `#[warn(clippy::redundant_field_names)]` on by default
|
clippy_check
The following actions uses node12 which is deprecated and will be forced to run on node16: actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|