From 6ee74ba1264264bb6bc045e65fd6e86b737d09a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Autin?= Date: Fri, 10 Mar 2023 11:03:54 +0100 Subject: [PATCH] Fixed more clippy complaining --- src/simulator/loader.rs | 2 +- src/simulator/mem_cmp.rs | 20 +++----------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/simulator/loader.rs b/src/simulator/loader.rs index 7d31d18..b7b4b36 100644 --- a/src/simulator/loader.rs +++ b/src/simulator/loader.rs @@ -15,7 +15,7 @@ use std::io::BufRead; /// /// - **path** the path of the file to load /// - **size** the number of bytes to write (1, 2, 4 or 8) -pub fn load(path : &str, instruction_size: i32) -> Machine { +pub fn _load(path : &str, instruction_size: i32) -> Machine { let file = fs::File::open(path).expect("Wrong filename"); let reader = io::BufReader::new(file); let mut machine = Machine::_init_machine(); diff --git a/src/simulator/mem_cmp.rs b/src/simulator/mem_cmp.rs index 00c45b8..780437e 100644 --- a/src/simulator/mem_cmp.rs +++ b/src/simulator/mem_cmp.rs @@ -55,7 +55,6 @@ impl Section{ let len: usize = string_hex_to_usize(§ion.len); let mut tmp_a: char = ' '; - let mut tmp_b: char = ' '; for (i, c) in section.content.chars().enumerate(){ @@ -63,8 +62,7 @@ impl Section{ tmp_a = c; } else { - tmp_b = c; - content.push(two_hex_to_u8(tmp_a,tmp_b)); + content.push(two_hex_to_u8(tmp_a,c)); } } @@ -150,7 +148,7 @@ impl MemChecker{ let section_f = SectionFormat{ addr: tmp_addr_str.clone(), len: tmp_len_str.clone(), - content: current_line.clone().replace(" ", ""), + content: current_line.clone().replace(' ', ""), }; sections.push(Section::from(§ion_f)); } @@ -172,7 +170,7 @@ impl MemChecker{ for(i,s) in m_c.sections.iter().enumerate() { println!("\nSection {}\n", i); - Section::print_section(&s); + Section::print_section(s); } } @@ -374,18 +372,6 @@ mod tests { assert_eq!(section.content, expected_vec); } - #[test] - fn test_mod(){ - let cond = (0%2) == 0; - assert!(cond); - } - - #[test] - fn test_mod_2(){ - let cond = (1%2) == 1; - assert!(cond); - } - #[test] fn test_hex_1(){ let b = two_hex_to_u8('0', '0');