diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8370b51ea..a176e1868 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,9 +19,9 @@ jobs: - name: clippy run: cargo clippy --workspace -- -D warnings - name: clippy no-std - run: cargo clippy --workspace --no-default-features -- -D warnings + run: cargo clippy --workspace --no-default-features --all-targets -- -D warnings - name: clippy with features - run: cargo clippy --workspace --features=with-codec,with-serde -- -D warnings + run: cargo clippy --workspace --all-features --all-targets -- -D warnings build: runs-on: ubuntu-latest steps: diff --git a/interpreter/src/eval/mod.rs b/interpreter/src/eval/mod.rs index 98d5f39ca..fcbc5272c 100644 --- a/interpreter/src/eval/mod.rs +++ b/interpreter/src/eval/mod.rs @@ -51,7 +51,7 @@ where self.0.map(|f| { let fr = wrapper(f, current_opcode); if current_opcode != Opcode(255) { - current_opcode.0 += current_opcode.0; + current_opcode.0 += 1; } fr }), diff --git a/interpreter/src/memory.rs b/interpreter/src/memory.rs index ed8bc3a92..decbba885 100644 --- a/interpreter/src/memory.rs +++ b/interpreter/src/memory.rs @@ -1,3 +1,6 @@ +#[cfg(not(feature = "std"))] +use alloc::vec; + use crate::{ExitException, ExitFatal}; use alloc::vec::Vec; use core::ops::{BitAnd, Not, Range}; diff --git a/interpreter/tests/usability.rs b/interpreter/tests/usability.rs index 181bd2044..0ac85d1b7 100644 --- a/interpreter/tests/usability.rs +++ b/interpreter/tests/usability.rs @@ -11,8 +11,8 @@ const RET1: &str = "000000000000000000000000000000000000000000000000000000000000 #[test] fn etable_wrap() { - let code = hex::decode(&CODE1).unwrap(); - let data = hex::decode(&DATA1).unwrap(); + let code = hex::decode(CODE1).unwrap(); + let data = hex::decode(DATA1).unwrap(); let wrapped_etable = Etable::<_, _, Opcode>::core().wrap(|f, opcode_t| { move |machine, handle, opcode, position| { @@ -24,14 +24,15 @@ fn etable_wrap() { let mut vm = Machine::new(Rc::new(code), Rc::new(data), 1024, 10000, ()); let result = vm.run(&mut (), &wrapped_etable); - assert_eq!(result, Capture::Exit(Ok(ExitSucceed::Returned.into()))); - assert_eq!(vm.retval, hex::decode(&RET1).unwrap()); + assert_eq!(result, Capture::Exit(Ok(ExitSucceed::Returned))); + assert_eq!(vm.retval, hex::decode(RET1).unwrap()); } #[test] +#[allow(clippy::type_complexity)] fn etable_wrap2() { - let code = hex::decode(&CODE1).unwrap(); - let data = hex::decode(&DATA1).unwrap(); + let code = hex::decode(CODE1).unwrap(); + let data = hex::decode(DATA1).unwrap(); let wrapped_etable = Etable::core().wrap( |f, opcode_t| -> Box, &mut (), Opcode, usize) -> Control> { @@ -87,7 +88,7 @@ impl RuntimeEnvironment for UnimplementedHandler { } } -impl<'a> RuntimeBaseBackend for UnimplementedHandler { +impl RuntimeBaseBackend for UnimplementedHandler { fn balance(&self, _address: H160) -> U256 { unimplemented!() } @@ -113,7 +114,7 @@ impl<'a> RuntimeBaseBackend for UnimplementedHandler { } } -impl<'a> RuntimeBackend for UnimplementedHandler { +impl RuntimeBackend for UnimplementedHandler { fn original_storage(&self, _address: H160, _index: H256) -> H256 { unimplemented!() } @@ -167,8 +168,8 @@ static RUNTIME_ETABLE: Etable = Etab #[test] fn etable_runtime() { - let code = hex::decode(&CODE1).unwrap(); - let data = hex::decode(&DATA1).unwrap(); + let code = hex::decode(CODE1).unwrap(); + let data = hex::decode(DATA1).unwrap(); let mut handler = UnimplementedHandler; let mut vm = Machine::new( @@ -193,6 +194,6 @@ fn etable_runtime() { ); let res = vm.run(&mut handler, &RUNTIME_ETABLE).exit().unwrap(); - assert_eq!(res, Ok(ExitSucceed::Returned.into())); - assert_eq!(vm.retval, hex::decode(&RET1).unwrap()); + assert_eq!(res, Ok(ExitSucceed::Returned)); + assert_eq!(vm.retval, hex::decode(RET1).unwrap()); }