mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-06-13 10:31:10 +00:00
Add a clippy job to the CI (#163)
* Add clippy CI check * Fix remaining clippy lints * Cargo fmt
This commit is contained in:
committed by
GitHub
parent
b8e6b9e319
commit
72626a566a
+3
-2
@@ -100,8 +100,9 @@ pub fn build(
|
||||
if !skip_optimization {
|
||||
let preserved_exports = match target_runtime {
|
||||
TargetRuntime::PWasm(_) => vec![target_runtime.symbols().create],
|
||||
TargetRuntime::Substrate(_) =>
|
||||
vec![target_runtime.symbols().call, target_runtime.symbols().create],
|
||||
TargetRuntime::Substrate(_) => {
|
||||
vec![target_runtime.symbols().call, target_runtime.symbols().create]
|
||||
},
|
||||
};
|
||||
optimize(&mut ctor_module, preserved_exports)?;
|
||||
}
|
||||
|
||||
@@ -153,8 +153,7 @@ fn build_control_flow_graph(
|
||||
|
||||
graph.set_first_instr_pos(entry_node_id, 0);
|
||||
|
||||
let mut stack = Vec::new();
|
||||
stack.push(ControlFrame::new(entry_node_id, terminal_node_id, false));
|
||||
let mut stack = vec![ControlFrame::new(entry_node_id, terminal_node_id, false)];
|
||||
|
||||
let mut metered_blocks_iter = blocks.iter().peekable();
|
||||
for (cursor, instruction) in body.code().elements().iter().enumerate() {
|
||||
|
||||
+8
-6
@@ -32,10 +32,12 @@ impl fmt::Display for Error {
|
||||
Error::NoTypeSection => write!(f, "No type section in the module"),
|
||||
Error::NoExportSection => write!(f, "No export section in the module"),
|
||||
Error::NoCodeSection => write!(f, "No code section inthe module"),
|
||||
Error::InvalidCreateSignature(sym) =>
|
||||
write!(f, "Exported symbol `{}` has invalid signature, should be () -> ()", sym),
|
||||
Error::InvalidCreateMember(sym) =>
|
||||
write!(f, "Exported symbol `{}` should be a function", sym),
|
||||
Error::InvalidCreateSignature(sym) => {
|
||||
write!(f, "Exported symbol `{}` has invalid signature, should be () -> ()", sym)
|
||||
},
|
||||
Error::InvalidCreateMember(sym) => {
|
||||
write!(f, "Exported symbol `{}` should be a function", sym)
|
||||
},
|
||||
Error::NoCreateSymbol(sym) => write!(f, "No exported `{}` symbol", sym),
|
||||
Error::NoImportSection => write!(f, "No import section in the module"),
|
||||
}
|
||||
@@ -285,7 +287,7 @@ mod test {
|
||||
.module("env")
|
||||
.field("memory")
|
||||
.external()
|
||||
.memory(1 as u32, Some(1 as u32))
|
||||
.memory(1, Some(1))
|
||||
.build()
|
||||
.function()
|
||||
.signature()
|
||||
@@ -336,7 +338,7 @@ mod test {
|
||||
.module("env")
|
||||
.field("memory")
|
||||
.external()
|
||||
.memory(1 as u32, Some(1 as u32))
|
||||
.memory(1, Some(1))
|
||||
.build()
|
||||
.data()
|
||||
.offset(elements::Instruction::I32Const(16))
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ mod tests {
|
||||
let mut module = builder::module()
|
||||
.with_global(GlobalEntry::new(
|
||||
GlobalType::new(ValueType::I32, false),
|
||||
InitExpr::new(vec![Instruction::I32Const(42 as i32)]),
|
||||
InitExpr::new(vec![Instruction::I32Const(42)]),
|
||||
))
|
||||
.build();
|
||||
let mut runtime_type: [u8; 4] = Default::default();
|
||||
|
||||
Reference in New Issue
Block a user