Skip to content

Merge pull request #13 from entropic-security/v0.10.0 #196

Merge pull request #13 from entropic-security/v0.10.0

Merge pull request #13 from entropic-security/v0.10.0 #196

GitHub Actions / clippy succeeded Nov 21, 2023 in 1s

clippy

20 warnings

Details

Results

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

Versions

  • rustc 1.73.0 (cc66ad468 2023-10-03)
  • cargo 1.73.0 (9c4383fb5 2023-08-26)
  • clippy 0.1.73 (cc66ad4 2023-10-03)

Annotations

Check warning on line 100 in src/semantics.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

match expression looks like `matches!` macro

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)
    |

Check warning on line 247 in src/filters.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant closure

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

Check warning on line 248 in src/filters.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `map(..).flatten()` on `Iterator`

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

Check warning on line 203 in src/filters.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant closure

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

Check warning on line 204 in src/filters.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `map(..).flatten()` on `Iterator`

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

Check warning on line 196 in src/filters.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

explicit call to `.into_iter()` in function argument accepting `IntoIterator`

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

Check warning on line 172 in src/filters.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

explicit call to `.into_iter()` in function argument accepting `IntoIterator`

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

Check warning on line 302 in src/search.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

mutable key type

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

Check warning on line 75 in src/search.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

mutable key type

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

Check warning on line 73 in src/gadget/gadget.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

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/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

Check warning on line 152 in src/gadget/analysis.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `map(..).flatten()` on `Iterator`

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 +             })
    |

Check warning on line 121 in src/gadget/analysis.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

explicit call to `.into_iter()` in function argument accepting `IntoIterator`

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()),
    |

Check warning on line 115 in src/gadget/analysis.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

explicit call to `.into_iter()` in function argument accepting `IntoIterator`

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()),
    |

Check warning on line 92 in src/gadget/analysis.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `map(..).flatten()` on `Iterator`

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

Check warning on line 79 in src/gadget/analysis.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `map(..).flatten()` on `Iterator`

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

Check warning on line 60 in src/gadget/analysis.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`

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

Check warning on line 59 in src/gadget/analysis.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`

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

Check warning on line 118 in src/binary/consts.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `Register` which implements the `Copy` trait

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

Check warning on line 368 in src/binary/binary.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `format!`

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

Check warning on line 366 in src/binary/binary.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `format!`

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