Skip to content
This repository was archived by the owner on Jun 21, 2020. It is now read-only.

Commit 4611462

Browse files
committed
MAINT: Fixed whatever cargo clippy told me
1 parent 493eebd commit 4611462

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

enigma-core/app/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extern crate rocksdb;
1111
#[macro_use]
1212
extern crate lazy_static;
1313
// networking apt install libzmq3-dev
14-
#[macro_use]
14+
#[cfg_attr(test, macro_use)]
1515
extern crate serde_json;
1616
extern crate zmq;
1717
// errors

enigma-core/app/src/wasm_u/wasm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub struct WasmResult {
9191
pub eth_contract_addr: [u8;20],
9292
}
9393

94-
pub fn execute(eid: sgx_enclave_id_t, bytecode: Box<[u8]>, callable: &str, args: &str)-> Result<WasmResult,Error>{
94+
pub fn execute(eid: sgx_enclave_id_t, bytecode: &[u8], callable: &str, args: &str)-> Result<WasmResult,Error>{
9595
let mut retval: EnclaveReturn = EnclaveReturn::Success;
9696
let mut output = 0u64;
9797
let mut delta_data_ptr = 0u64;
@@ -195,7 +195,7 @@ pub mod tests {
195195
let enclave = init_enclave();
196196
let contract_code = compile_and_deploy_wasm_contract(enclave.geteid(), "../../examples/eng_wasm_contracts/simplest");
197197
// let result = wasm::execute(enclave.geteid(),contract_code, "test(uint256,uint256)", "c20102").expect("Execution failed");
198-
let result = wasm::execute(enclave.geteid(), contract_code, "write()", "").expect("Execution failed");
198+
let result = wasm::execute(enclave.geteid(), &contract_code, "write()", "").expect("Execution failed");
199199
enclave.destroy();
200200
assert_eq!(from_utf8(&result.output).unwrap(), "\"157\"");
201201
}
@@ -204,7 +204,7 @@ pub mod tests {
204204
fn eth_bridge() {
205205
let enclave = init_enclave();
206206
let contract_code = compile_and_deploy_wasm_contract(enclave.geteid(), "../../examples/eng_wasm_contracts/contract_with_eth_calls");
207-
let result = wasm::execute(enclave.geteid(), contract_code, "test()", "").expect("Execution failed");
207+
let result = wasm::execute(enclave.geteid(), &contract_code, "test()", "").expect("Execution failed");
208208
enclave.destroy();
209209
}
210210

@@ -220,7 +220,7 @@ pub mod tests {
220220
println!("Bytecode size: {}KB\n", wasm_code.len() / 1024);
221221
let enclave = init_enclave();
222222
let contract_code = wasm::deploy(enclave.geteid(), &wasm_code).expect("Deploy Failed");
223-
let result = wasm::execute(enclave.geteid(),contract_code, "call", "").expect("Execution failed");
223+
let result = wasm::execute(enclave.geteid(),&contract_code, "call", "").expect("Execution failed");
224224
assert_eq!(from_utf8(&result.output).unwrap(), "157");
225225
}
226226
}

enigma-tools-t/src/build_arguments_g/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ pub fn get_types(function: &str) -> Result<(String, String), EnclaveError>{
3636
Ok(( function[start_arg_index+1..end_arg_index].to_string(), String::from(&function[..start_arg_index] )))
3737
}
3838

39-
pub fn get_args(callable_args: &[u8], types: &Vec<String>) -> Result<Vec<String>, EnclaveError>{
39+
pub fn get_args(callable_args: &[u8], types: &[String]) -> Result<Vec<String>, EnclaveError>{
4040
decode_args(callable_args, types)
4141
}
4242

4343
pub fn extract_types(types: &str) -> Vec<String>{
4444
let mut types_vector: Vec<String> = vec![];
45-
let types_iterator = types.split(",");
45+
let types_iterator = types.split(',');
4646
for each_type in types_iterator{
4747
types_vector.push(each_type.to_string());
4848
}

enigma-tools-t/src/cryptography_t/asymmetric.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ impl KeyPair {
1616
loop {
1717
let mut me: [u8; 32] = [0; 32];
1818
rsgx_read_rand(&mut me)?;
19-
match SecretKey::parse(&me) {
20-
Ok(_priv) => return Ok(KeyPair { privkey: _priv.clone(), pubkey: PublicKey::from_secret_key(&_priv) }),
21-
Err(_) => (),
22-
}
19+
if let Ok(_priv) = SecretKey::parse(&me) { return Ok(KeyPair { privkey: _priv.clone(), pubkey: PublicKey::from_secret_key(&_priv) }) }
2320
}
2421
}
2522

enigma-tools-u/src/web3_utils/w3utils.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use failure::Error;
33
use hex::FromHex;
44
use std::str;
55
use std::time;
6-
use tiny_keccak::Keccak;
76
//web3
87
use web3;
98
use web3::contract::tokens::Tokenize;

0 commit comments

Comments
 (0)