From e9a22fc82a154207f37adcec294e6f2a51b26313 Mon Sep 17 00:00:00 2001 From: Tamo Date: Sun, 14 Sep 2025 13:18:44 +0200 Subject: [PATCH 1/2] make clippy works on wasm --- .github/workflows/rust.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7d3507f..4ec5059 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -46,7 +46,8 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.85.0 + target: wasm32-unknown-unknown override: true components: clippy - uses: actions-rs/cargo@v1 From 8b6040fcdb301ec33b7a53df3d220a45e1ae4c6d Mon Sep 17 00:00:00 2001 From: Tamo Date: Sun, 14 Sep 2025 13:21:58 +0200 Subject: [PATCH 2/2] fix clippy warningsU --- src/course_format.rs | 10 +++------- src/snowflake_id_format.rs | 12 ++++-------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/course_format.rs b/src/course_format.rs index 8e7cf2d..2b3b180 100644 --- a/src/course_format.rs +++ b/src/course_format.rs @@ -41,16 +41,12 @@ pub fn course_format_full(list_course: &str) -> String { if to_format.is_empty() { final_string } else { - let mut previous_char = to_format.chars().nth(0).unwrap(); + let mut previous_char = to_format.chars().next().unwrap(); for item in to_format.chars() { if item.is_alphanumeric() && item != ' ' { final_string = final_string + &item.to_string(); - } else { - if previous_char.is_alphanumeric() { - if !final_string.is_empty() { - final_string = final_string + ", " - } - } + } else if previous_char.is_alphanumeric() && !final_string.is_empty() { + final_string += ", " } previous_char = item; } diff --git a/src/snowflake_id_format.rs b/src/snowflake_id_format.rs index 69f60fb..f5e1d13 100644 --- a/src/snowflake_id_format.rs +++ b/src/snowflake_id_format.rs @@ -41,20 +41,16 @@ pub fn course_format_full(list_course: &str) -> String { if to_format.is_empty() { final_string } else { - let mut previous_char = to_format.chars().nth(0).unwrap(); + let mut previous_char = to_format.chars().next().unwrap(); for item in to_format.chars() { if item.is_alphanumeric() && item != ' ' { final_string = final_string + &item.to_string(); - } else { - if previous_char.is_alphanumeric() { - if !final_string.is_empty() { - final_string = final_string + "', '" - } - } + } else if previous_char.is_alphanumeric() && !final_string.is_empty() { + final_string += "', '" } previous_char = item; } - final_string = final_string + "'"; + final_string += "'"; final_string } }