Merge pull request #13 from entropic-security/v0.10.0 #196
Annotations
21 warnings
match expression looks like `matches!` macro:
src/semantics.rs#L91
warning: match expression looks like `matches!` macro
--> src/semantics.rs:91:5
|
91 | / match instr.mnemonic() {
92 | | iced_x86::Mnemonic::Iret
93 | | | iced_x86::Mnemonic::Iretd
94 | | | iced_x86::Mnemonic::Iretq
... |
99 | | _ => false,
100 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
= note: `#[warn(clippy::match_like_matches_macro)]` on by default
help: try
|
91 ~ matches!(instr.mnemonic(), iced_x86::Mnemonic::Iret
92 + | iced_x86::Mnemonic::Iretd
93 + | iced_x86::Mnemonic::Iretq
94 + | iced_x86::Mnemonic::Sysexit
95 + | iced_x86::Mnemonic::Sysexitq
96 + | iced_x86::Mnemonic::Sysret
97 + | iced_x86::Mnemonic::Sysretq)
|
|
redundant closure:
src/filters.rs#L247
warning: redundant closure
--> src/filters.rs:247:30
|
247 | .map(|r| get_reg_family(r))
| ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `get_reg_family`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
|
called `map(..).flatten()` on `Iterator`:
src/filters.rs#L247
warning: called `map(..).flatten()` on `Iterator`
--> src/filters.rs:247:26
|
247 | .map(|r| get_reg_family(r))
| __________________________^
248 | | .flatten()
| |__________________________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|r| get_reg_family(r))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
|
redundant closure:
src/filters.rs#L203
warning: redundant closure
--> src/filters.rs:203:30
|
203 | .map(|r| get_reg_family(r))
| ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `get_reg_family`
|
= 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
|
called `map(..).flatten()` on `Iterator`:
src/filters.rs#L203
warning: called `map(..).flatten()` on `Iterator`
--> src/filters.rs:203:26
|
203 | .map(|r| get_reg_family(r))
| __________________________^
204 | | .flatten()
| |__________________________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|r| get_reg_family(r))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
|
explicit call to `.into_iter()` in function argument accepting `IntoIterator`:
src/filters.rs#L196
warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
--> src/filters.rs:196:24
|
196 | .chain(analysis.regs_updated().into_iter())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `analysis.regs_updated()`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
--> /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/iter/traits/iterator.rs:523:12
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
|
explicit call to `.into_iter()` in function argument accepting `IntoIterator`:
src/filters.rs#L172
warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
--> src/filters.rs:172:24
|
172 | .chain(analysis.regs_updated().into_iter())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `analysis.regs_updated()`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
--> /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/iter/traits/iterator.rs:523:12
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
|
mutable key type:
src/search.rs#L302
warning: mutable key type
--> src/search.rs:302:6
|
302 | ) -> HashSet<gadget::Gadget> {
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mutable_key_type
|
mutable key type:
src/search.rs#L75
warning: mutable key type
--> src/search.rs:75:13
|
75 | let mut common_gadgets = first_set.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mutable_key_type
= note: `#[warn(clippy::mutable_key_type)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/gadget/gadget.rs#L73
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/gadget/gadget.rs:73:58
|
73 | self.analysis.get_or_init(|| GadgetAnalysis::new(&self))
| ^^^^^ help: change this to: `self`
|
= 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
|
called `map(..).flatten()` on `Iterator`:
src/gadget/analysis.rs#L132
warning: called `map(..).flatten()` on `Iterator`
--> src/gadget/analysis.rs:132:14
|
132 | .map(|info| {
| ______________^
133 | | info.used_regs
134 | | .iter()
135 | | .filter(move |ur| {
... |
151 | | })
152 | | .flatten()
| |______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
help: try replacing `map` with `flat_map` and remove the `.flatten()`
|
132 ~ .flat_map(|info| {
133 + info.used_regs
134 + .iter()
135 + .filter(move |ur| {
136 + ((ur.access() == iced_x86::OpAccess::ReadWrite && info.mnemonic == iced_x86::Mnemonic::Xchg)
137 + || (ur.access() == iced_x86::OpAccess::Write))
138 + && !matches!(
139 + info.mem_base,
140 + iced_x86::Register::RIP | iced_x86::Register::EIP,
141 + )
142 + // Written directly or via sub-register name
143 + && if include_sub_regs {
144 + true
145 + // Written directly (named operand)
146 + } else {
147 + info.op_regs.contains(&ur.register())
148 + }
149 + })
150 + .map(|ur| ur.register())
151 + })
|
|
explicit call to `.into_iter()` in function argument accepting `IntoIterator`:
src/gadget/analysis.rs#L118
warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
--> src/gadget/analysis.rs:118:17
|
118 | / self.used_mem()
119 | | .filter(|um| um.index() != iced_x86::Register::None)
120 | | .map(|um| um.index())
121 | | .into_iter(),
| |________________________________^
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
--> /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/iter/traits/iterator.rs:523:12
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
help: consider removing the `.into_iter()`
|
118 ~ self.used_mem()
119 + .filter(|um| um.index() != iced_x86::Register::None)
120 ~ .map(|um| um.index()),
|
|
explicit call to `.into_iter()` in function argument accepting `IntoIterator`:
src/gadget/analysis.rs#L112
warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
--> src/gadget/analysis.rs:112:17
|
112 | / self.used_mem()
113 | | .filter(|um| um.base() != iced_x86::Register::None)
114 | | .map(|um| um.base())
115 | | .into_iter(),
| |________________________________^
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
--> /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/iter/traits/iterator.rs:523:12
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `#[warn(clippy::useless_conversion)]` on by default
help: consider removing the `.into_iter()`
|
112 ~ self.used_mem()
113 + .filter(|um| um.base() != iced_x86::Register::None)
114 ~ .map(|um| um.base()),
|
|
called `map(..).flatten()` on `Iterator`:
src/gadget/analysis.rs#L91
warning: called `map(..).flatten()` on `Iterator`
--> src/gadget/analysis.rs:91:22
|
91 | .map(|info| info.used_mem.iter().copied())
| ______________________^
92 | | .flatten()
| |______________________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|info| info.used_mem.iter().copied())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
|
called `map(..).flatten()` on `Iterator`:
src/gadget/analysis.rs#L78
warning: called `map(..).flatten()` on `Iterator`
--> src/gadget/analysis.rs:78:22
|
78 | .map(|info| info.used_regs.iter().copied())
| ______________________^
79 | | .flatten()
| |______________________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|info| info.used_regs.iter().copied())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
= note: `#[warn(clippy::map_flatten)]` on by default
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
src/gadget/analysis.rs#L60
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/gadget/analysis.rs:60:54
|
60 | used_mem: info.used_memory().into_iter().cloned().collect(),
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
src/gadget/analysis.rs#L59
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/gadget/analysis.rs:59:58
|
59 | used_regs: info.used_registers().into_iter().cloned().collect(),
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
= note: `#[warn(clippy::into_iter_on_ref)]` on by default
|
using `clone` on type `Register` which implements the `Copy` trait:
src/binary/consts.rs#L118
warning: using `clone` on type `Register` which implements the `Copy` trait
--> src/binary/consts.rs:118:19
|
118 | _ => vec![reg.clone()].into_iter(),
| ^^^^^^^^^^^ help: try dereferencing it: `*reg`
|
= 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
|
useless use of `format!`:
src/binary/binary.rs#L368
warning: useless use of `format!`
--> src/binary/binary.rs:368:13
|
368 | format!("{}", num_fmt(seg_cnt)).bright_blue(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `num_fmt(seg_cnt).to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
|
useless use of `format!`:
src/binary/binary.rs#L366
warning: useless use of `format!`
--> src/binary/binary.rs:366:13
|
366 | format!("{}", num_fmt(bytes)).bright_blue(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `num_fmt(bytes).to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
= note: `#[warn(clippy::useless_format)]` on by default
|
run_clippy_check
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, 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/
|