Skip to content

Commit 990d76d

Browse files
committed
fmt,clippy,sort
1 parent 7361760 commit 990d76d

File tree

9 files changed

+16
-24
lines changed

9 files changed

+16
-24
lines changed

crates/revm/src/evm_impl.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
use crate::{
22
db::Database,
3-
gas,
4-
interpreter,
5-
Gas,
3+
gas, interpreter,
64
interpreter::{Contract, Interpreter},
75
models::SelfDestructResult,
86
return_ok,
97
subroutine::{Account, State, SubRoutine},
10-
CallContext, CreateScheme, Env, Inspector, Log, Return, Spec,
8+
CallContext, CreateScheme, Env, Gas, Inspector, Log, Return, Spec,
119
SpecId::*,
1210
TransactOut, TransactTo, Transfer, KECCAK_EMPTY,
1311
};

crates/revm/src/gas/calc.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ pub fn create2_cost(len: usize) -> Option<u64> {
6363
Some(gas)
6464
}
6565

66-
6766
fn log2floor(value: U256) -> u64 {
6867
assert!(!value.is_zero());
6968
let mut l: u64 = 256;
@@ -92,9 +91,8 @@ pub fn exp_cost<SPEC: Spec>(power: U256) -> Option<u64> {
9291
} else {
9392
10
9493
}); // EIP-160: EXP cost increase
95-
let gas = U256::from(EXP).checked_add(
96-
gas_byte.checked_mul(U256::from(log2floor(power) / 8 + 1))?,
97-
)?;
94+
let gas = U256::from(EXP)
95+
.checked_add(gas_byte.checked_mul(U256::from(log2floor(power) / 8 + 1))?)?;
9896

9997
if gas > U256::from(u64::MAX) {
10098
return None;

crates/revm/src/inspector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use bytes::Bytes;
22
use primitive_types::{H160, U256};
33

44
use crate::{
5-
evm_impl::EVMData, Gas, CallContext, CreateScheme, Database, Interpreter, Return, Transfer,
5+
evm_impl::EVMData, CallContext, CreateScheme, Database, Gas, Interpreter, Return, Transfer,
66
};
77
use auto_impl::auto_impl;
88

crates/revm/src/instructions.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ mod system;
99

1010
pub use opcode::{OpCode, OPCODE_JUMPMAP};
1111

12-
use crate::{
13-
interpreter::Interpreter,
14-
Spec, SpecId::*,
15-
CallScheme, Host,
16-
};
12+
use crate::{interpreter::Interpreter, CallScheme, Host, Spec, SpecId::*};
1713
use core::ops::{BitAnd, BitOr, BitXor};
1814
use primitive_types::U256;
1915

crates/revm/src/instructions/misc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{interpreter::Interpreter,gas, Return, Spec, SpecId::*};
1+
use crate::{gas, interpreter::Interpreter, Return, Spec, SpecId::*};
22
use primitive_types::{H256, U256};
33

44
pub fn codesize(machine: &mut Interpreter) -> Return {
@@ -88,7 +88,7 @@ pub fn mload(machine: &mut Interpreter) -> Return {
8888
memory_resize!(machine, index, 32);
8989
push!(
9090
machine,
91-
U256::from_big_endian(machine.memory.get_slice(index, 32).as_ref())
91+
U256::from_big_endian(machine.memory.get_slice(index, 32))
9292
);
9393
Return::Continue
9494
}

crates/revm/src/instructions/system.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{
2-
interpreter::Interpreter,gas, return_ok, return_revert, CallContext, CallScheme, CreateScheme,
2+
gas, interpreter::Interpreter, return_ok, return_revert, CallContext, CallScheme, CreateScheme,
33
Host, Return, Spec, Transfer,
44
};
55
// CallScheme, Capture, CallContext, CreateScheme, ,

crates/revm/src/interpreter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ pub use memory::Memory;
77
pub use stack::Stack;
88

99
use crate::{
10-
instructions::{eval, Return}, USE_GAS, Gas,
10+
instructions::{eval, Return},
11+
Gas, USE_GAS,
1112
};
13+
use crate::{Host, Spec};
1214
use bytes::Bytes;
1315
use core::ops::Range;
14-
use crate::{Spec, Host};
1516

1617
pub const STACK_LIMIT: u64 = 1024;
1718
pub const CALL_STACK_LIMIT: u64 = 1024;
@@ -35,7 +36,6 @@ pub struct Interpreter {
3536
pub call_depth: u64,
3637
}
3738

38-
3939
impl Interpreter {
4040
pub fn new<SPEC: Spec>(contract: Contract, gas_limit: u64, call_depth: u64) -> Self {
4141
Self {
@@ -127,4 +127,4 @@ impl Interpreter {
127127
))
128128
}
129129
}
130-
}
130+
}

crates/revm/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@
44
pub mod db;
55
mod evm;
66
mod evm_impl;
7+
pub(crate) mod gas;
78
mod inspector;
89
mod instructions;
910
mod interpreter;
1011
mod models;
1112
mod specification;
1213
mod subroutine;
13-
pub(crate) mod gas;
1414

1515
pub use evm_impl::{EVMData, Host};
1616

1717
pub type DummyStateDB = InMemoryDB;
1818

1919
pub use db::{Database, DatabaseCommit, InMemoryDB};
2020
pub use evm::{new, EVM};
21+
pub use gas::Gas;
2122
pub use inspector::{Inspector, NoOpInspector, OverrideSpec};
2223
pub use instructions::{
2324
opcode::{self, spec_opcode_gas, OpCode, OPCODE_JUMPMAP},
2425
Return,
2526
};
2627
pub use interpreter::Interpreter;
27-
pub use gas::Gas;
2828
pub use models::*;
2929
pub use specification::*;
3030
pub use subroutine::{Account, SubRoutine};

crates/revm/src/specification.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub trait Spec: Sized {
8181
}
8282

8383
mod spec_impl {
84-
use super::{NotStaticSpec,Spec};
84+
use super::{NotStaticSpec, Spec};
8585

8686
macro_rules! spec {
8787
($spec_id:tt) => {

0 commit comments

Comments
 (0)