Fixed some clippy complaining
This commit is contained in:
parent
6db52669b4
commit
44e3f586e2
@ -2,7 +2,6 @@ use std::fs;
|
||||
use std::io::BufRead;
|
||||
use std::io::BufReader;
|
||||
use std::io::Lines;
|
||||
use std::io::Read;
|
||||
use crate::Machine;
|
||||
|
||||
const MEM_SIZE : usize = 4096;
|
||||
@ -239,7 +238,7 @@ impl MemChecker{
|
||||
|
||||
fn string_hex_to_usize(s: &String) -> usize {
|
||||
|
||||
if s.len() == 0 {
|
||||
if s.is_empty() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -253,7 +252,7 @@ fn string_hex_to_usize(s: &String) -> usize {
|
||||
ret_value += base.pow(max_pow - (i as u32))*tmp;
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
ret_value
|
||||
}
|
||||
|
||||
|
||||
@ -271,8 +270,7 @@ fn one_hex_to_dec(c: char) -> u8 {
|
||||
'E' | 'e' => 14,
|
||||
'F' | 'f' => 15,
|
||||
_ => {
|
||||
let ret : u8 = c.to_digit(10).unwrap() as u8;
|
||||
return ret;
|
||||
c.to_digit(10).unwrap() as u8
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -368,12 +366,7 @@ mod tests {
|
||||
};
|
||||
|
||||
let section = Section::from(§ion_format);
|
||||
let mut expected_vec: Vec<u8> = Vec::new();
|
||||
expected_vec.push(0u8);
|
||||
expected_vec.push(255u8);
|
||||
expected_vec.push(10u8);
|
||||
expected_vec.push(160u8);
|
||||
expected_vec.push(165u8);
|
||||
let expected_vec: Vec<u8> = vec![0u8, 255u8, 10u8, 160u8, 165u8];
|
||||
|
||||
//println!("Vec from created section {:?}", §ion.content);
|
||||
//println!("Expected vec {:?}", &expected_vec);
|
||||
@ -384,13 +377,13 @@ mod tests {
|
||||
#[test]
|
||||
fn test_mod(){
|
||||
let cond = (0%2) == 0;
|
||||
assert_eq!(true, cond);
|
||||
assert!(cond);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mod_2(){
|
||||
let cond = (1%2) == 1;
|
||||
assert_eq!(true, cond);
|
||||
assert!(cond);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user