Firmware Ninja relationships API #314
Annotations
7 errors
call to `reserve` immediately after creation:
rust/rust/src/flowgraph.rs#L57
error: call to `reserve` immediately after creation
--> ./rust/rust/src/flowgraph.rs:57:9
|
57 | / let mut result = vec![];
58 | | result.reserve(count);
| |______________________________^ help: consider using `Vec::with_capacity(/* Space hint */)`: `let mut result = Vec::with_capacity(count);`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#reserve_after_initialization
= note: `-D clippy::reserve-after-initialization` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::reserve_after_initialization)]`
|
the loop variable `i` is only used to index `nodes`:
rust/rust/src/flowgraph.rs#L60
error: the loop variable `i` is only used to index `nodes`
--> ./rust/rust/src/flowgraph.rs:60:18
|
60 | for i in 0..count {
| ^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
= note: `-D clippy::needless-range-loop` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::needless_range_loop)]`
help: consider using an iterator
|
60 | for <item> in nodes.iter().take(count) {
| ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
|
method `next` can be confused for the standard trait method `std::iter::Iterator::next`:
rust/rust/src/linear_view.rs#L336
error: method `next` can be confused for the standard trait method `std::iter::Iterator::next`
--> ./rust/rust/src/linear_view.rs:336:5
|
336 | / pub fn next(&mut self) -> bool {
337 | | unsafe { BNLinearViewCursorNext(self.handle) }
338 | | }
| |_____^
|
= help: consider implementing the trait `std::iter::Iterator` 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: `-D clippy::should-implement-trait` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::should_implement_trait)]`
|
called `map(..).flatten()` on `Iterator`:
rust/rust/src/render_layer.rs#L116
error: called `map(..).flatten()` on `Iterator`
--> ./rust/rust/src/render_layer.rs:116:14
|
116 | .map(|(line_ty, basic_block, lines)| {
| ______________^
117 | | match line_ty {
118 | | LinearDisassemblyLineType::CodeDisassemblyLineType => {
119 | | // Dealing with code lines.
... |
140 | | })
141 | | .flatten()
| |______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
= note: `-D clippy::map-flatten` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::map_flatten)]`
help: try replacing `map` with `flat_map` and remove the `.flatten()`
|
116 ~ .flat_map(|(line_ty, basic_block, lines)| {
117 + match line_ty {
118 + LinearDisassemblyLineType::CodeDisassemblyLineType => {
119 + // Dealing with code lines.
120 + let block = basic_block.expect("Code line has no basic block");
121 + let function = block.function();
122 + let text_lines = lines.into_iter().map(|line| line.contents).collect();
123 + let new_text_lines = self.apply_to_block(&block, text_lines);
124 + let new_lines = new_text_lines
125 + .into_iter()
126 + .map(|line| text_to_lines(&function, &block, line))
127 + .collect();
128 + new_lines
129 + }
130 + _ => {
131 + // Dealing with misc lines.
132 + self.apply_to_misc_lines(
133 + object,
134 + _prev_object.as_deref(),
135 + _next_object.as_deref(),
136 + lines,
137 + )
138 + }
139 + }
140 + })
|
|
returning the result of a `let` binding from a block:
rust/rust/src/render_layer.rs#L128
error: returning the result of a `let` binding from a block
--> ./rust/rust/src/render_layer.rs:128:25
|
124 | / let new_lines = new_text_lines
125 | | .into_iter()
126 | | .map(|line| text_to_lines(&function, &block, line))
127 | | .collect();
| |_______________________________________- unnecessary `let` binding
128 | new_lines
| ^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
= note: `-D clippy::let-and-return` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::let_and_return)]`
help: return the expression directly
|
124 ~
125 ~ new_text_lines
126 + .into_iter()
127 + .map(|line| text_to_lines(&function, &block, line))
128 + .collect()
|
|
redundant closure:
rust/rust/src/render_layer.rs#L265
error: redundant closure
--> ./rust/rust/src/render_layer.rs:265:34
|
265 | NonNull::new(result).map(|x| Self::from_raw(x))
| ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `Self::from_raw`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
= note: `-D clippy::redundant-closure` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::redundant_closure)]`
|
cargo clippy
Error: Clippy has exited with exit code 101
|