wasmx / wasm-chisel

Some useful utilities to transform WebAssembly binaries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove compiler warnings

aarlt opened this issue · comments

I think its good if we get rid of the warnings generated by the compiler

warning: unused import: `parity_wasm::builder::*`
 --> libchisel/src/dropsection.rs:3:5
  |
3 | use parity_wasm::builder::*;
  |     ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default

warning: unused import: `ValueType`
 --> libchisel/src/verifyimports.rs:5:82
  |
5 | use parity_wasm::elements::{External, FunctionType, ImportSection, Module, Type, ValueType};
  |                                                                                  ^^^^^^^^^

warning: unused imports: `CodeSection`, `Func`, `FunctionSection`
 --> libchisel/src/depgraph.rs:3:29
  |
3 | use parity_wasm::elements::{CodeSection, Func, FuncBody, FunctionSection, Instruction, Module};
  |                             ^^^^^^^^^^^  ^^^^            ^^^^^^^^^^^^^^^

warning: unused import: `crate::utils`
 --> libchisel/src/deployer.rs:2:5
  |
2 | use crate::utils::*;
  |     ^^^^^^^^^^^^

warning: unreachable pattern
   --> libchisel/src/verifyexports.rs:155:17
    |
155 |                 _ => None,
    |                 ^
    |
    = note: #[warn(unreachable_patterns)] on by default

warning: unreachable pattern
   --> libchisel/src/verifyexports.rs:161:21
    |
161 |                     _ => None,
    |                     ^

warning: unused variable: `module`
  --> libchisel/src/repack.rs:14:33
   |
14 |     fn translate_inplace(&self, module: &mut Module) -> Result<bool, ModuleError> {
   |                                 ^^^^^^ help: consider prefixing with an underscore: `_module`
   |
   = note: #[warn(unused_variables)] on by default

warning: unused variable: `start_section`
 --> libchisel/src/trimstartfunc.rs:8:21
  |
8 |         if let Some(start_section) = module.start_section() {
  |                     ^^^^^^^^^^^^^ help: consider prefixing with an underscore: `_start_section`

warning: unused variable: `module`
  --> libchisel/src/trimstartfunc.rs:31:25
   |
31 |     fn translate(&self, module: &Module) -> Result<Option<Module>, ModuleError> {
   |                         ^^^^^^ help: consider prefixing with an underscore: `_module`

warning: unused variable: `import_section`
   --> libchisel/src/verifyexports.rs:164:25
    |
164 |             (None, Some(import_section)) => None,
    |                         ^^^^^^^^^^^^^^ help: consider prefixing with an underscore: `_import_section`

warning: unused variable: `import_section`
   --> libchisel/src/verifyimports.rs:277:9
    |
277 |     let import_section = module.import_section().expect("No function section found");
    |         ^^^^^^^^^^^^^^ help: consider prefixing with an underscore: `_import_section`

warning: variable does not need to be mutable
   --> libchisel/src/verifyimports.rs:105:21
    |
105 |                 let mut checklist: Vec<ImportStatus> = self
    |                     ----^^^^^^^^^
    |                     |
    |                     help: remove this `mut`
    |
    = note: #[warn(unused_mut)] on by default

warning: variable does not need to be mutable
  --> libchisel/src/utils.rs:14:13
   |
14 |         let mut module = self
   |             ----^^^^^^
   |             |
   |             help: remove this `mut`

warning: private trait `depgraph::DepGraphManager` in public interface (error E0445)
  --> libchisel/src/depgraph.rs:27:1
   |
27 | / pub trait DepGraphBuilder: DepGraphManager {
28 | |     /// Builds the dependency graph.
29 | |     fn build(module: &Module, entry_idx: u32) -> Result<Self, ()>
30 | |     where
31 | |         Self: std::marker::Sized;
32 | | }
   | |_^
   |
   = note: #[warn(private_in_public)] on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>

warning: method is never used: `insert`
   --> libchisel/src/remapimports.rs:177:5
    |
177 |     fn insert(&mut self, from_module: &str, from_field: &str, to_module: &str, to_field: &str) {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: #[warn(dead_code)] on by default

warning: method is never used: `edgecount`
  --> libchisel/src/depgraph.rs:41:5
   |
41 |     pub fn edgecount(&self) -> usize {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Compiling serde_derive v1.0.92
   Compiling serde_yaml v0.8.9
   Compiling chisel v0.4.0 (/private/tmp/wasm/wasm-chisel/chisel)
warning: variable does not need to be mutable
  --> chisel/src/main.rs:76:24
   |
76 |             for (name, mut config) in rules.iter().filter(|(left, right)| match (left, right) {
   |                        ----^^^^^^
   |                        |
   |                        help: remove this `mut`
   |
   = note: #[warn(unused_mut)] on by default

I have a PR ready for this, just haven't pushed yet 😉

Great! 😄