Fixing a couple clippy warnings : #392
This commit is contained in:
@@ -51,10 +51,10 @@ impl SubTest for TestVerifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
match verify_function(func, context.flags_or_isa()) {
|
match verify_function(func, context.flags_or_isa()) {
|
||||||
Ok(()) if expected.len() == 0 => Ok(()),
|
Ok(()) if expected.is_empty() => Ok(()),
|
||||||
Ok(()) => Err(format!("passed, but expected errors: {:?}", expected)),
|
Ok(()) => Err(format!("passed, but expected errors: {:?}", expected)),
|
||||||
|
|
||||||
Err(ref errors) if expected.len() == 0 => {
|
Err(ref errors) if expected.is_empty() => {
|
||||||
Err(format!("expected no error, but got:\n{}", errors))
|
Err(format!("expected no error, but got:\n{}", errors))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ impl SubTest for TestVerifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg.len() == 0 {
|
if msg.is_empty() {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(msg)
|
Err(msg)
|
||||||
|
|||||||
@@ -33,16 +33,15 @@ fn call_ser(file: &str, pretty: bool) -> Result<(), String> {
|
|||||||
match ret_of_parse {
|
match ret_of_parse {
|
||||||
Ok(funcs) => {
|
Ok(funcs) => {
|
||||||
let ser_funcs = serde_clif_json::SerObj::new(&funcs);
|
let ser_funcs = serde_clif_json::SerObj::new(&funcs);
|
||||||
let ser_str: String;
|
let ser_str = if pretty {
|
||||||
if pretty {
|
serde_json::to_string_pretty(&ser_funcs).unwrap()
|
||||||
ser_str = serde_json::to_string_pretty(&ser_funcs).unwrap();
|
|
||||||
} else {
|
} else {
|
||||||
ser_str = serde_json::to_string(&ser_funcs).unwrap();
|
serde_json::to_string(&ser_funcs).unwrap()
|
||||||
}
|
};
|
||||||
println!("{}", ser_str);
|
println!("{}", ser_str);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Err(_pe) => Err(format!("There was a parsing error")),
|
Err(_pe) => Err("There was a parsing error".to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +98,7 @@ fn main() {
|
|||||||
File::open(m.value_of("FILE").unwrap()).expect("Unable to open the file");
|
File::open(m.value_of("FILE").unwrap()).expect("Unable to open the file");
|
||||||
call_de(&file)
|
call_de(&file)
|
||||||
}
|
}
|
||||||
_ => Err(format!("Invalid subcommand.")),
|
_ => Err("Invalid subcommand.".to_string()),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(mut msg) = res_serde {
|
if let Err(mut msg) = res_serde {
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ pub fn get_inst_data(inst_index: Inst, func: &Function) -> SerInstData {
|
|||||||
},
|
},
|
||||||
InstructionData::UnaryBool { opcode, imm } => SerInstData::UnaryBool {
|
InstructionData::UnaryBool { opcode, imm } => SerInstData::UnaryBool {
|
||||||
opcode: opcode.to_string(),
|
opcode: opcode.to_string(),
|
||||||
imm: imm,
|
imm,
|
||||||
},
|
},
|
||||||
InstructionData::UnaryGlobalValue {
|
InstructionData::UnaryGlobalValue {
|
||||||
opcode,
|
opcode,
|
||||||
@@ -759,10 +759,10 @@ impl SerSignature {
|
|||||||
fn create_new(sig: &Signature) -> Self {
|
fn create_new(sig: &Signature) -> Self {
|
||||||
let mut params_vec: Vec<String> = Vec::new();
|
let mut params_vec: Vec<String> = Vec::new();
|
||||||
let mut returns_vec: Vec<String> = Vec::new();
|
let mut returns_vec: Vec<String> = Vec::new();
|
||||||
for param in sig.params.iter() {
|
for param in &sig.params {
|
||||||
params_vec.push(param.to_string());
|
params_vec.push(param.to_string());
|
||||||
}
|
}
|
||||||
for ret in sig.returns.iter() {
|
for ret in &sig.returns {
|
||||||
returns_vec.push(ret.to_string());
|
returns_vec.push(ret.to_string());
|
||||||
}
|
}
|
||||||
Self {
|
Self {
|
||||||
@@ -818,7 +818,7 @@ impl SerObj {
|
|||||||
Self { functions: funcs }
|
Self { functions: funcs }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(funcs: &Vec<Function>) -> Self {
|
pub fn new(funcs: &[Function]) -> Self {
|
||||||
let mut func_vec: Vec<SerFunction> = Vec::new();
|
let mut func_vec: Vec<SerFunction> = Vec::new();
|
||||||
for func in funcs {
|
for func in funcs {
|
||||||
let mut ser_func: SerFunction = SerFunction::new(&func);
|
let mut ser_func: SerFunction = SerFunction::new(&func);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ impl SimpleJITBuilder {
|
|||||||
/// back to a platform-specific search (this typically involves searching
|
/// back to a platform-specific search (this typically involves searching
|
||||||
/// the current process for public symbols, followed by searching the
|
/// the current process for public symbols, followed by searching the
|
||||||
/// platform's C runtime).
|
/// platform's C runtime).
|
||||||
pub fn symbol<'a, K>(&'a mut self, name: K, ptr: *const u8) -> &'a mut Self
|
pub fn symbol<K>(&mut self, name: K, ptr: *const u8) -> &Self
|
||||||
where
|
where
|
||||||
K: Into<String>,
|
K: Into<String>,
|
||||||
{
|
{
|
||||||
@@ -71,7 +71,7 @@ impl SimpleJITBuilder {
|
|||||||
/// Define multiple symbols in the internal symbol table.
|
/// Define multiple symbols in the internal symbol table.
|
||||||
///
|
///
|
||||||
/// Using this is equivalent to calling `symbol` on each element.
|
/// Using this is equivalent to calling `symbol` on each element.
|
||||||
pub fn symbols<'a, It, K>(&'a mut self, symbols: It) -> &'a mut Self
|
pub fn symbols<It, K>(&mut self, symbols: It) -> &Self
|
||||||
where
|
where
|
||||||
It: IntoIterator<Item = (K, *const u8)>,
|
It: IntoIterator<Item = (K, *const u8)>,
|
||||||
K: Into<String>,
|
K: Into<String>,
|
||||||
|
|||||||
Reference in New Issue
Block a user