From 6a6c590a76f670ce4e894d003c1bf26a1726adf2 Mon Sep 17 00:00:00 2001 From: "orestis.malaspin" <orestis.malaspinas@hesge.ch> Date: Tue, 10 Sep 2024 14:35:28 +0200 Subject: [PATCH] Fix formatting --- codes/rust_lang/cli/src/io.rs | 35 +++++++++++++++--------------- codes/rust_lang/unsafe/src/main.rs | 2 +- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/codes/rust_lang/cli/src/io.rs b/codes/rust_lang/cli/src/io.rs index 47d75e2..1858b50 100644 --- a/codes/rust_lang/cli/src/io.rs +++ b/codes/rust_lang/cli/src/io.rs @@ -59,7 +59,7 @@ fn write_to_file(output: &str, numbers: &[i32]) -> Result<(), String> { /// these numbers. Returns errors when the parsing fails. pub fn read_command_line_builder() -> Result<(), String> { // ANCHOR: matches - let matches = + let matches = // ANCHOR: new_command Command::new(COMMAND) .author(AUTHOR) @@ -97,29 +97,28 @@ pub fn read_command_line_builder() -> Result<(), String> { // ANCHOR_END: matches // ANCHOR: numbers_matches - let numbers = - if let Some(count) = + let numbers = if let Some(count) = // ANCHOR: get_one_matches - matches.get_one::<usize>("count") - // ANCHOR_END: get_one_matches - { - read_from_urandom(*count)? - } else if let Some(numbers) = + matches.get_one::<usize>("count") + // ANCHOR_END: get_one_matches + { + read_from_urandom(*count)? + } else if let Some(numbers) = // ANCHOR: get_many_matches - matches.get_many::<i32>("numbers") - // ANCHOR_END: get_many_matches - { - numbers.copied().collect() - } else { - Vec::new() - }; + matches.get_many::<i32>("numbers") + // ANCHOR_END: get_many_matches + { + numbers.copied().collect() + } else { + Vec::new() + }; // ANCHOR_END: numbers_matches // ANCHOR: output_matches - if let Some(output) = + if let Some(output) = // ANCHOR: get_one_string_matches - matches.get_one::<String>("output") - // ANCHOR_END: get_one_string_matches + matches.get_one::<String>("output") + // ANCHOR_END: get_one_string_matches { write_to_file(output, &numbers)?; } else { diff --git a/codes/rust_lang/unsafe/src/main.rs b/codes/rust_lang/unsafe/src/main.rs index 523802d..6189be4 100644 --- a/codes/rust_lang/unsafe/src/main.rs +++ b/codes/rust_lang/unsafe/src/main.rs @@ -38,7 +38,7 @@ fn main() { safe_list.print(); unsafe_list.print(); - for j in 1..1000 { + for _j in 1..1000 { let mut ul = UnsafeList::new(); for i in 1..1_000_000 { ul.push(i); -- GitLab