Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions src/course_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
12 changes: 4 additions & 8 deletions src/snowflake_id_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Loading