From f0f38a8031f675411bf8bac50e6e85e7ffd9f7b0 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 10 Jan 2023 11:53:19 +0100 Subject: [PATCH] follow clippy advices --- src/timetable.rs | 6 +++--- src/utils.rs | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/timetable.rs b/src/timetable.rs index edd69f3..65a86c4 100644 --- a/src/timetable.rs +++ b/src/timetable.rs @@ -353,7 +353,7 @@ pub fn display(timetable: (Vec, (usize, Vec)), cell_length: // Print day's of the week let mut days = HashMap::new(); - for (i, data) in (&timetable.1 .1).iter().enumerate() { + for (i, data) in timetable.1 .1.iter().enumerate() { days.insert(i, &data.name); print!("{:^cell_length$}{}", &data.name, sep); } @@ -372,12 +372,12 @@ pub fn display(timetable: (Vec, (usize, Vec)), cell_length: print!("{}{:^clh$}", sep, hour); // For all the days - `j` the day's number - for (j, day) in (&timetable.1 .1).iter().enumerate() { + for (j, day) in timetable.1 .1.iter().enumerate() { // True if we found something about the slot we are looking for let mut info_slot = false; // For all the courses of each days - `k` the possible course.start - for (k, course_opt) in (&day.courses).iter().enumerate() { + for (k, course_opt) in day.courses.iter().enumerate() { match course_opt { // If there is a course Some(course) => { diff --git a/src/utils.rs b/src/utils.rs index 01b7d90..c03101d 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -71,12 +71,9 @@ pub fn line_table( // Check if it's a big cell if i == range - 1 { // Friday only - match skip_with.get(&i) { - Some(text) => { - println!("{:^cell_length$}{}", text, rsbc_bbc); - last_day = true; - } - None => (), + if let Some(text) = skip_with.get(&i) { + println!("{:^cell_length$}{}", text, rsbc_bbc); + last_day = true; } } else { match skip_with.get(&i) {