Add a clippy job to the CI (#163)

* Add clippy CI check

* Fix remaining clippy lints

* Cargo fmt
This commit is contained in:
Alexander Theißen
2021-07-27 15:50:50 +02:00
committed by GitHub
parent b8e6b9e319
commit 72626a566a
6 changed files with 34 additions and 14 deletions
+3 -2
View File
@@ -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)?;
}
+1 -2
View File
@@ -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
View File
@@ -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
View File
@@ -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();