Skip to content

Avoid redundant push to the queue in incremental simulation; surprisi… #179

Avoid redundant push to the queue in incremental simulation; surprisi…

Avoid redundant push to the queue in incremental simulation; surprisi… #179

GitHub Actions / Clippy Output succeeded Jan 25, 2024 in 1s

Clippy Output

100 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 100
Note 0
Help 0

Versions

  • rustc 1.75.0 (82e1608df 2023-12-21)
  • cargo 1.75.0 (1d8b05cdd 2023-11-20)
  • clippy 0.1.75 (82e1608 2023-12-21)

Annotations

Check warning on line 104 in src/sim.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

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
   --> src/sim.rs:104:54
    |
104 | pub(crate) fn detects_faults(aig: &Network, pattern: &Vec<bool>, faults: &Vec<Fault>) -> Vec<bool> {
    |                                                      ^^^^^^^^^^ help: change this to: `&[bool]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg

Check warning on line 59 in src/sim.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

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
  --> src/sim.rs:59:19
   |
59 |     input_values: &Vec<bool>,
   |                   ^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
help: change this to
   |
59 ~     input_values: &[bool],
60 |     faults: &Vec<Fault>,
61 | ) -> Vec<bool> {
62 |     assert!(a.is_comb());
63 ~     let input = vec![input_values.to_owned()];
   |

Check warning on line 38 in src/sim.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

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
  --> src/sim.rs:38:49
   |
38 | pub fn simulate_comb(a: &Network, input_values: &Vec<bool>) -> Vec<bool> {
   |                                                 ^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
help: change this to
   |
38 ~ pub fn simulate_comb(a: &Network, input_values: &[bool]) -> Vec<bool> {
39 |     assert!(a.is_comb());
40 ~     let input = vec![input_values.to_owned()];
   |

Check warning on line 115 in src/sim/simple_sim.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

the loop variable `i` is used to index `next_values`

warning: the loop variable `i` is used to index `next_values`
   --> src/sim/simple_sim.rs:115:18
    |
115 |         for i in 0..self.aig.nb_nodes() {
    |                  ^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
    |
115 |         for (i, <item>) in next_values.iter_mut().enumerate().take(self.aig.nb_nodes()) {
    |             ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 63 in src/sim/simple_sim.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

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
  --> src/sim/simple_sim.rs:63:23
   |
63 |         input_values: &Vec<Vec<u64>>,
   |                       ^^^^^^^^^^^^^^ help: change this to: `&[Vec<u64>]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg

Check warning on line 45 in src/sim/simple_sim.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

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
  --> src/sim/simple_sim.rs:45:41
   |
45 |     pub fn run(&mut self, input_values: &Vec<Vec<u64>>) -> Vec<Vec<u64>> {
   |                                         ^^^^^^^^^^^^^^ help: change this to: `&[Vec<u64>]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg

Check warning on line 56 in src/sim/incremental_sim.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

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
  --> src/sim/incremental_sim.rs:56:49
   |
56 |     pub fn run_initial(&mut self, input_values: &Vec<u64>) {
   |                                                 ^^^^^^^^^ help: change this to: `&[u64]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg

Check warning on line 48 in src/sim/fault.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

this boolean expression can be simplified

warning: this boolean expression can be simplified
  --> src/sim/fault.rs:48:24
   |
48 |         ret.retain(|f| !redundant.binary_search(f).is_ok());
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `redundant.binary_search(f).is_err()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
   = note: `#[warn(clippy::nonminimal_bool)]` on by default

Check warning on line 344 in src/optim/share_logic.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> src/optim/share_logic.rs:344:24
    |
344 |     *aig = factor_nary(&aig);
    |                        ^^^^ help: change this to: `aig`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 343 in src/optim/share_logic.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> src/optim/share_logic.rs:343:25
    |
343 |     *aig = flatten_nary(&aig, flattening_limit);
    |                         ^^^^ help: change this to: `aig`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 335 in src/optim/share_logic.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

redundant closure

warning: redundant closure
   --> src/optim/share_logic.rs:335:52
    |
335 |     let aig2 = factor_gates(&aig1, |g| g.is_xor(), |a, b| Gate::xor(a, b));
    |                                                    ^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `Gate::xor`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure

Check warning on line 334 in src/optim/share_logic.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

redundant closure

warning: redundant closure
   --> src/optim/share_logic.rs:334:50
    |
334 |     let aig1 = factor_gates(aig, |g| g.is_and(), |a, b| Gate::and(a, b));
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `Gate::and`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure

Check warning on line 336 in src/optim/share_logic.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

returning the result of a `let` binding from a block

warning: returning the result of a `let` binding from a block
   --> src/optim/share_logic.rs:336:5
    |
335 |     let aig2 = factor_gates(&aig1, |g| g.is_xor(), |a, b| Gate::xor(a, b));
    |     ----------------------------------------------------------------------- unnecessary `let` binding
336 |     aig2
    |     ^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
    = note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
    |
335 ~     
336 ~     factor_gates(&aig1, |g| g.is_xor(), |a, b| Gate::xor(a, b))
    |

Check warning on line 321 in src/network/network.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

the loop variable `i` is used to index `visited`

warning: the loop variable `i` is used to index `visited`
   --> src/network/network.rs:321:18
    |
321 |         for i in 0..self.nb_nodes() {
    |                  ^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
    |
321 |         for (i, <item>) in visited.iter_mut().enumerate().take(self.nb_nodes()) {
    |             ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 289 in src/network/network.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

the loop variable `i` is only used to index `new_nodes`

warning: the loop variable `i` is only used to index `new_nodes`
   --> src/network/network.rs:289:18
    |
289 |         for i in 0..new_nodes.len() {
    |                  ^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator
    |
289 |         for <item> in &mut new_nodes {
    |             ~~~~~~    ~~~~~~~~~~~~~~

Check warning on line 273 in src/network/network.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

the loop variable `i` is used to index `translation`

warning: the loop variable `i` is used to index `translation`
   --> src/network/network.rs:273:18
    |
273 |         for i in 0..self.nb_nodes() {
    |                  ^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
    |
273 |         for (i, <item>) in translation.iter_mut().enumerate().take(self.nb_nodes()) {
    |             ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 7 in src/network.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

module has the same name as its containing module

warning: module has the same name as its containing module
 --> src/network.rs:7:1
  |
7 | mod network;
  | ^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_inception
  = note: `#[warn(clippy::module_inception)]` on by default

Check warning on line 280 in src/network/gates.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

redundant closure

warning: redundant closure
   --> src/network/gates.rs:280:47
    |
280 |                 inputs: lut.inputs.iter().map(|s| t(s)).collect(),
    |                                               ^^^^^^^^ help: replace the closure with the function itself: `t`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure

Check warning on line 277 in src/network/gates.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

redundant closure

warning: redundant closure
   --> src/network/gates.rs:277:46
    |
277 |             Nary(v, tp) => Nary(v.iter().map(|s| t(s)).collect(), *tp),
    |                                              ^^^^^^^^ help: replace the closure with the function itself: `t`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
    = note: `#[warn(clippy::redundant_closure)]` on by default

Check warning on line 267 in src/network/gates.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

unneeded `return` statement

warning: unneeded `return` statement
   --> src/network/gates.rs:267:9
    |
267 |         return matches!(self, Gate::Buf(_));
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
267 -         return matches!(self, Gate::Buf(_));
267 +         matches!(self, Gate::Buf(_))
    |

Check warning on line 262 in src/network/gates.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

unneeded `return` statement

warning: unneeded `return` statement
   --> src/network/gates.rs:256:9
    |
256 | /         return matches!(
257 | |             self,
258 | |             Gate::Binary(_, BinaryType::Xor)
259 | |                 | Gate::Ternary(_, TernaryType::Xor)
260 | |                 | Gate::Nary(_, NaryType::Xor)
261 | |                 | Gate::Nary(_, NaryType::Xnor)
262 | |         );
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
256 ~         matches!(
257 +             self,
258 +             Gate::Binary(_, BinaryType::Xor)
259 +                 | Gate::Ternary(_, TernaryType::Xor)
260 +                 | Gate::Nary(_, NaryType::Xor)
261 +                 | Gate::Nary(_, NaryType::Xnor)
262 ~         )
    |

Check warning on line 251 in src/network/gates.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

unneeded `return` statement

warning: unneeded `return` statement
   --> src/network/gates.rs:243:9
    |
243 | /         return matches!(
244 | |             self,
245 | |             Gate::Binary(_, BinaryType::And)
246 | |                 | Gate::Ternary(_, TernaryType::And)
...   |
250 | |                 | Gate::Nary(_, NaryType::Nor)
251 | |         );
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
243 ~         matches!(
244 +             self,
245 +             Gate::Binary(_, BinaryType::And)
246 +                 | Gate::Ternary(_, TernaryType::And)
247 +                 | Gate::Nary(_, NaryType::And)
248 +                 | Gate::Nary(_, NaryType::Nand)
249 +                 | Gate::Nary(_, NaryType::Or)
250 +                 | Gate::Nary(_, NaryType::Nor)
251 ~         )
    |

Check warning on line 238 in src/network/gates.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

unneeded `return` statement

warning: unneeded `return` statement
   --> src/network/gates.rs:233:9
    |
233 | /         return matches!(
234 | |             self,
235 | |             Gate::Binary(_, BinaryType::Xor)
236 | |                 | Gate::Ternary(_, TernaryType::Xor)
237 | |                 | Gate::Nary(_, NaryType::Xor)
238 | |         );
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
233 ~         matches!(
234 +             self,
235 +             Gate::Binary(_, BinaryType::Xor)
236 +                 | Gate::Ternary(_, TernaryType::Xor)
237 +                 | Gate::Nary(_, NaryType::Xor)
238 ~         )
    |

Check warning on line 228 in src/network/gates.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

unneeded `return` statement

warning: unneeded `return` statement
   --> src/network/gates.rs:223:9
    |
223 | /         return matches!(
224 | |             self,
225 | |             Gate::Binary(_, BinaryType::And)
226 | |                 | Gate::Ternary(_, TernaryType::And)
227 | |                 | Gate::Nary(_, NaryType::And)
228 | |         );
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
223 ~         matches!(
224 +             self,
225 +             Gate::Binary(_, BinaryType::And)
226 +                 | Gate::Ternary(_, TernaryType::And)
227 +                 | Gate::Nary(_, NaryType::And)
228 ~         )
    |

Check warning on line 218 in src/network/gates.rs

See this annotation in the file changed.

@github-actions github-actions / Clippy Output

unneeded `return` statement

warning: unneeded `return` statement
   --> src/network/gates.rs:218:9
    |
218 |         return !matches!(self, Gate::Dff(_));
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = 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`
    |
218 -         return !matches!(self, Gate::Dff(_));
218 +         !matches!(self, Gate::Dff(_))
    |