clippy lints #302
clippy
28 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 28 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.76.0 (07dca489a 2024-02-04)
- cargo 1.76.0 (c84b36747 2024-01-18)
- clippy 0.1.76 (07dca48 2024-02-04)
Annotations
Check warning on line 91 in ddo/examples/sop/io_utils.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/io_utils.rs:91:21
|
91 | let i = (lc - 1) as usize;
| ^^^^^^^^^^^^^^^^^ help: try: `(lc - 1)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 46 in ddo/examples/sop/heuristics.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/heuristics.rs:46:25
|
46 | self.nb_vars * (state.depth as usize + 1) * self.factor
| ^^^^^^^^^^^^^^^^^^^^ help: try: `state.depth`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 139 in ddo/examples/sop/relax.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/relax.rs:139:28
|
139 | let n_must_visit = state.must_schedule.len() as usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `state.must_schedule.len()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 138 in ddo/examples/sop/relax.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/relax.rs:138:54
|
138 | let complete_tour = self.pb.nb_variables() - state.depth as usize;
| ^^^^^^^^^^^^^^^^^^^^ help: try: `state.depth`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 96 in ddo/examples/sop/relax.rs
github-actions / clippy
using `clone` on type `Set256` which implements the `Copy` trait
warning: using `clone` on type `Set256` which implements the `Copy` trait
--> ddo/examples/sop/relax.rs:96:25
|
96 | let mut maybe = self.all_maybe.clone(); // three lines: faster because it is in-place
| ^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.all_maybe`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
Check warning on line 93 in ddo/examples/sop/relax.rs
github-actions / clippy
using `clone` on type `Set256` which implements the `Copy` trait
warning: using `clone` on type `Set256` which implements the `Copy` trait
--> ddo/examples/sop/relax.rs:93:9
|
93 | self.all_agree.clone()
| ^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.all_agree`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
Check warning on line 90 in ddo/examples/sop/relax.rs
github-actions / clippy
using `clone` on type `Set256` which implements the `Copy` trait
warning: using `clone` on type `Set256` which implements the `Copy` trait
--> ddo/examples/sop/relax.rs:90:27
|
90 | Previous::Virtual(self.previous.clone())
| ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.previous`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
Check warning on line 72 in ddo/examples/sop/relax.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/relax.rs:72:59
|
72 | Previous::Job(x) => self.previous.add_inplace(*x as usize),
| ^^^^^^^^^^^ help: try: `*x`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 155 in ddo/examples/sop/model.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/model.rs:155:66
|
155 | .map(|i| self.instance.distances[i as usize][j as usize])
| ^^^^^^^^^^ help: try: `j`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 155 in ddo/examples/sop/model.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/model.rs:155:54
|
155 | .map(|i| self.instance.distances[i as usize][j as usize])
| ^^^^^^^^^^ help: try: `i`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 151 in ddo/examples/sop/model.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/model.rs:151:41
|
151 | self.instance.distances[*i as usize][j]
| ^^^^^^^^^^^ help: try: `*i`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 148 in ddo/examples/sop/model.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/model.rs:148:60
|
148 | Previous::Job(i) => if self.instance.distances[*i as usize][j] == -1 {
| ^^^^^^^^^^^ help: try: `*i`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 85 in ddo/examples/sop/model.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/model.rs:85:12
|
85 | if state.depth as usize == self.nb_variables() - 1 {
| ^^^^^^^^^^^^^^^^^^^^ help: try: `state.depth`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 75 in ddo/examples/sop/model.rs
github-actions / clippy
using `clone` on type `SopState` which implements the `Copy` trait
warning: using `clone` on type `SopState` which implements the `Copy` trait
--> ddo/examples/sop/model.rs:75:9
|
75 | self.initial.clone()
| ^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.initial`
|
= 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
Check warning on line 71 in ddo/examples/sop/model.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/model.rs:71:9
|
71 | (self.instance.nb_jobs - 1) as usize
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(self.instance.nb_jobs - 1)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 50 in ddo/examples/sop/model.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/model.rs:50:17
|
50 | let n = inst.nb_jobs as usize;
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `inst.nb_jobs`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 38 in ddo/examples/sop/model.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> ddo/examples/sop/model.rs:38:67
|
38 | (1..inst.nb_jobs).for_each(|i| {must_schedule.add_inplace(i as usize);});
| ^^^^^^^^^^ help: try: `i`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
= note: `#[warn(clippy::unnecessary_cast)]` on by default
Check warning on line 192 in ddo/examples/alp/model.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> ddo/examples/alp/model.rs:192:20
|
192 | if used.len() == 0 {
| ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `used.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
= note: `#[warn(clippy::len_zero)]` on by default
Check warning on line 177 in ddo/examples/srflp/relax.rs
github-actions / clippy
the loop variable `i` is used to index `lengths`
warning: the loop variable `i` is used to index `lengths`
--> ddo/examples/srflp/relax.rs:177:18
|
177 | for i in 0..(complete_arrangement-1) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
= note: `#[warn(clippy::needless_range_loop)]` on by default
help: consider using an iterator and enumerate()
|
177 | for (i, <item>) in lengths.iter().enumerate().take((complete_arrangement-1)) {
| ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Check warning on line 101 in ddo/examples/alp/model.rs
github-actions / clippy
methods called `from_*` usually take no `self`
warning: methods called `from_*` usually take no `self`
--> ddo/examples/alp/model.rs:101:26
|
101 | pub fn from_decision(&self, value: isize) -> AlpDecision {
| ^^^^^
|
= help: consider choosing a less ambiguous name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
= note: `#[warn(clippy::wrong_self_convention)]` on by default
Check warning on line 85 in ddo/examples/alp/model.rs
github-actions / clippy
writing `&Vec` instead of `&[_]` involves a new object where a slice will do
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> ddo/examples/alp/model.rs:85:42
|
85 | pub fn get_arrival_time(&self, info: &Vec<RunwayState>, aircraft: usize, runway: usize) -> isize {
| ^^^^^^^^^^^^^^^^^ help: change this to: `&[RunwayState]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `#[warn(clippy::ptr_arg)]` on by default
Check warning on line 73 in ddo/examples/alp/model.rs
github-actions / clippy
the loop variable `j` is used to index `min_separation_to`
warning: the loop variable `j` is used to index `min_separation_to`
--> ddo/examples/alp/model.rs:73:22
|
73 | for j in 0..instance.nb_classes {
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
= note: `#[warn(clippy::needless_range_loop)]` on by default
help: consider using an iterator and enumerate()
|
73 | for (j, <item>) in min_separation_to.iter_mut().enumerate().take(instance.nb_classes) {
| ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Check warning on line 81 in ddo/examples/talentsched/io_utils.rs
github-actions / clippy
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> ddo/examples/talentsched/io_utils.rs:75:13
|
75 | / match data.next() {
76 | | Some(val) => {
77 | | nb_actors = val.parse()?;
78 | | i += 1;
79 | | },
80 | | None => (),
81 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: `#[warn(clippy::single_match)]` on by default
help: try
|
75 ~ if let Some(val) = data.next() {
76 + nb_actors = val.parse()?;
77 + i += 1;
78 + }
|
Check warning on line 47 in ddo/examples/talentsched/model.rs
github-actions / clippy
the loop variable `j` is used to index `actors`
warning: the loop variable `j` is used to index `actors`
--> ddo/examples/talentsched/model.rs:47:22
|
47 | for j in 0..instance.nb_scenes {
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
= note: `#[warn(clippy::needless_range_loop)]` on by default
help: consider using an iterator and enumerate()
|
47 | for (j, <item>) in actors.iter_mut().enumerate().take(instance.nb_scenes) {
| ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Check warning on line 31 in ddo/examples/lcs/dp.rs
github-actions / clippy
the loop variable `i` is only used to index `table`
warning: the loop variable `i` is only used to index `table`
--> ddo/examples/lcs/dp.rs:31:18
|
31 | for i in 0..=self.a.len() {
| ^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator
|
31 | for <item> in table.iter_mut().take(self.a.len() + 1) {
| ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~