diff --git a/ethcore/src/evm/instructions.rs b/ethcore/src/evm/instructions.rs index 623868618..6a1a06ba9 100644 --- a/ethcore/src/evm/instructions.rs +++ b/ethcore/src/evm/instructions.rs @@ -137,6 +137,7 @@ impl InstructionInfo { } } +#[cfg_attr(rustfmt, rustfmt_skip)] /// Return details about specific instruction pub fn get_info (instruction: Instruction) -> InstructionInfo { match instruction { @@ -301,7 +302,7 @@ pub const EXP: Instruction = 0x0a; pub const SIGNEXTEND: Instruction = 0x0b; /// less-than comparision -pub const LT: Instruction = 0x10; +pub const LT: Instruction = 0x10; /// greater-than comparision pub const GT: Instruction = 0x11; /// signed less-than comparision @@ -324,10 +325,10 @@ pub const NOT: Instruction = 0x19; pub const BYTE: Instruction = 0x1a; /// compute SHA3-256 hash -pub const SHA3: Instruction = 0x20; +pub const SHA3: Instruction = 0x20; /// get address of currently executing account -pub const ADDRESS: Instruction = 0x30; +pub const ADDRESS: Instruction = 0x30; /// get balance of the given account pub const BALANCE: Instruction = 0x31; /// get execution origination address @@ -367,7 +368,7 @@ pub const DIFFICULTY: Instruction = 0x44; pub const GASLIMIT: Instruction = 0x45; /// remove item from stack -pub const POP: Instruction = 0x50; +pub const POP: Instruction = 0x50; /// load word from memory pub const MLOAD: Instruction = 0x51; /// save word to memory @@ -392,7 +393,7 @@ pub const GAS: Instruction = 0x5a; pub const JUMPDEST: Instruction = 0x5b; /// place 1 byte item on stack -pub const PUSH1: Instruction = 0x60; +pub const PUSH1: Instruction = 0x60; /// place 2 byte item on stack pub const PUSH2: Instruction = 0x61; /// place 3 byte item on stack @@ -457,7 +458,7 @@ pub const PUSH31: Instruction = 0x7e; pub const PUSH32: Instruction = 0x7f; /// copies the highest item in the stack to the top of the stack -pub const DUP1: Instruction = 0x80; +pub const DUP1: Instruction = 0x80; /// copies the second highest item in the stack to the top of the stack pub const DUP2: Instruction = 0x81; /// copies the third highest item in the stack to the top of the stack @@ -490,7 +491,7 @@ pub const DUP15: Instruction = 0x8e; pub const DUP16: Instruction = 0x8f; /// swaps the highest and second highest value on the stack -pub const SWAP1: Instruction = 0x90; +pub const SWAP1: Instruction = 0x90; /// swaps the highest and third highest value on the stack pub const SWAP2: Instruction = 0x91; /// swaps the highest and 4th highest value on the stack @@ -523,7 +524,7 @@ pub const SWAP15: Instruction = 0x9e; pub const SWAP16: Instruction = 0x9f; /// Makes a log entry; no topics. -pub const LOG0: Instruction = 0xa0; +pub const LOG0: Instruction = 0xa0; /// Makes a log entry; 1 topic. pub const LOG1: Instruction = 0xa1; /// Makes a log entry; 2 topics. @@ -536,7 +537,7 @@ pub const LOG4: Instruction = 0xa4; pub const MAX_NO_OF_TOPICS : usize = 4; /// create a new account with associated code -pub const CREATE: Instruction = 0xf0; +pub const CREATE: Instruction = 0xf0; /// message-call into an account pub const CALL: Instruction = 0xf1; /// message-call with another account's code only @@ -546,5 +547,5 @@ pub const RETURN: Instruction = 0xf3; /// like CALLCODE but keeps caller's value and sender pub const DELEGATECALL: Instruction = 0xf4; /// halt execution and register account for later deletion -pub const SUICIDE: Instruction = 0xff; +pub const SUICIDE: Instruction = 0xff; diff --git a/fmt.sh b/fmt.sh new file mode 100755 index 000000000..a16d5ac1f --- /dev/null +++ b/fmt.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +RUSTFMT="rustfmt --write-mode overwrite" + +$RUSTFMT ./ethash/src/lib.rs +$RUSTFMT ./ethcore/src/lib.rs +$RUSTFMT ./evmjit/src/lib.rs +$RUSTFMT ./json/src/lib.rs +$RUSTFMT ./miner/src/lib.rs +$RUSTFMT ./parity/main.rs +$RUSTFMT ./rpc/src/lib.rs +$RUSTFMT ./sync/src/lib.rs +$RUSTFMT ./util/src/lib.rs + diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 000000000..0b377a371 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,14 @@ +verbose=false +max_width=150 +ideal_width=120 +tabs_spaces=4 +fn_call_width=100 +single_line_if_else=true +where_indent="Visual" +where_trailing_comma=true +chain_base_indent="Inherit" +chain_indent="Tabbed" +reorder_imports=true +format_strings=false +hard_tabs=true +wrap_match_arms=false diff --git a/util/rustfmt.toml b/util/rustfmt.toml deleted file mode 100644 index 218e20321..000000000 --- a/util/rustfmt.toml +++ /dev/null @@ -1 +0,0 @@ -hard_tabs = true diff --git a/util/src/crypto.rs b/util/src/crypto.rs index e5096a317..e9b3116fd 100644 --- a/util/src/crypto.rs +++ b/util/src/crypto.rs @@ -208,7 +208,7 @@ pub mod ec { match context.verify(&try!(Message::from_slice(&message)), &sig, &publ) { Ok(_) => Ok(true), Err(Error::IncorrectSignature) => Ok(false), - Err(x) => Err(>::from(x)) + Err(x) => Err(CryptoError::from(x)) } } diff --git a/util/src/rlp/rlpin.rs b/util/src/rlp/rlpin.rs index 9d3fcb2fa..945ae9b24 100644 --- a/util/src/rlp/rlpin.rs +++ b/util/src/rlp/rlpin.rs @@ -153,7 +153,7 @@ impl<'a, 'view> Iterator for RlpIterator<'a, 'view> { fn next(&mut self) -> Option> { let index = self.index; - let result = self.rlp.rlp.at(index).ok().map(| iter | { From::from(iter) }); + let result = self.rlp.rlp.at(index).ok().map(From::from); self.index += 1; result }