C headers: utility to generate c code from solc output #86
clippy
21 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 21 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.73.0-beta.5 (ea9959354 2023-09-09)
- cargo 1.73.0-beta.5 (9c4383fb5 2023-08-26)
- clippy 0.1.73 (ea99593 2023-09-09)
Annotations
Check warning on line 219 in src/c/header.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> src/c/header.rs:219:16
|
219 | if router_body.len() != 0 {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!router_body.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
Check warning on line 181 in src/c/header.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> src/c/header.rs:181:16
|
181 | if header_body.len() != 0 {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!header_body.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
Check warning on line 168 in src/c/header.rs
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/c/header.rs:168:46
|
168 | header_body.push_str(&label);
| ^^^^^^ help: change this to: `label`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 161 in src/c/header.rs
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/c/header.rs:161:46
|
161 | header_body.push_str(&label);
| ^^^^^^ help: change this to: `label`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 116 in src/c/header.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> src/c/header.rs:116:16
|
116 | if header_body.len() != 0 {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!header_body.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
Check warning on line 107 in src/c/header.rs
github-actions / clippy
useless use of `format!`
warning: useless use of `format!`
--> src/c/header.rs:107:29
|
107 | ... format!(" if (!bebi32_is_0(value)) revert();\n",).as_str(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `" if (!bebi32_is_0(value)) revert();\n".to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
Check warning on line 58 in src/c/header.rs
github-actions / clippy
use Vec::sort_by_key here instead
warning: use Vec::sort_by_key here instead
--> src/c/header.rs:58:17
|
58 | overloads.sort_by(|a, b| a.signature().cmp(&b.signature()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `overloads.sort_by_key(|a| a.signature())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by
Check warning on line 47 in src/c/header.rs
github-actions / clippy
use of `or_insert` to construct default value
warning: use of `or_insert` to construct default value
--> src/c/header.rs:47:26
|
47 | .or_insert(Vec::default())
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
Check warning on line 30 in src/c/header.rs
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/c/header.rs:30:29
|
30 | debug_path.push(&contract_name);
| ^^^^^^^^^^^^^^ help: change this to: `contract_name`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 26 in src/c/header.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/c/header.rs:26:22
|
26 | pathbuf.push(&solidity_file_name);
| ^^^^^^^^^^^^^^^^^^^ help: change this to: `solidity_file_name`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 260 in src/c/gen.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> src/c/gen.rs:260:16
|
260 | if router_body.len() != 0 {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!router_body.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
Check warning on line 222 in src/c/gen.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> src/c/gen.rs:222:16
|
222 | if header_body.len() != 0 {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!header_body.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
Check warning on line 207 in src/c/gen.rs
github-actions / clippy
`to_string` applied to a type that implements `Display` in `format!` args
warning: `to_string` applied to a type that implements `Display` in `format!` args
--> src/c/gen.rs:207:43
|
207 | ... offset.to_string(),
| ^^^^^^^^^^^^ help: remove this
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
= note: `#[warn(clippy::to_string_in_format_args)]` on by default
Check warning on line 165 in src/c/gen.rs
github-actions / clippy
manual `!RangeInclusive::contains` implementation
warning: manual `!RangeInclusive::contains` implementation
--> src/c/gen.rs:165:36
|
165 | ... if num > 32 || num < 0 {
| ^^^^^^^^^^^^^^^^^^^ help: use: `!(0..=32).contains(&num)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
= note: `#[warn(clippy::manual_range_contains)]` on by default
Check warning on line 124 in src/c/gen.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> src/c/gen.rs:124:16
|
124 | if header_body.len() != 0 {
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!header_body.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 115 in src/c/gen.rs
github-actions / clippy
useless use of `format!`
warning: useless use of `format!`
--> src/c/gen.rs:115:29
|
115 | ... format!(" if (!bebi32_is_0(value)) revert();\n",).as_str(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `" if (!bebi32_is_0(value)) revert();\n".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
Check warning on line 66 in src/c/gen.rs
github-actions / clippy
use Vec::sort_by_key here instead
warning: use Vec::sort_by_key here instead
--> src/c/gen.rs:66:17
|
66 | overloads.sort_by(|a, b| a.signature().cmp(&b.signature()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `overloads.sort_by_key(|a| a.signature())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by
= note: `#[warn(clippy::unnecessary_sort_by)]` on by default
Check warning on line 55 in src/c/gen.rs
github-actions / clippy
use of `or_insert` to construct default value
warning: use of `or_insert` to construct default value
--> src/c/gen.rs:55:26
|
55 | .or_insert(Vec::default())
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
= note: `#[warn(clippy::unwrap_or_default)]` on by default
Check warning on line 38 in src/c/gen.rs
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/c/gen.rs:38:29
|
38 | debug_path.push(&contract_name);
| ^^^^^^^^^^^^^^ help: change this to: `contract_name`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 34 in src/c/gen.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/c/gen.rs:34:22
|
34 | pathbuf.push(&solidity_file_name);
| ^^^^^^^^^^^^^^^^^^^ help: change this to: `solidity_file_name`
|
= 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 9 in src/c/header.rs
github-actions / clippy
function `c_gen` is never used
warning: function `c_gen` is never used
--> src/c/header.rs:9:8
|
9 | pub fn c_gen(in_path: String, out_path: String) -> eyre::Result<()> {
| ^^^^^
|
= note: `#[warn(dead_code)]` on by default