From b4e68d085da69e68529720bd3faf1dd3ad369a74 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Sun, 2 Apr 2023 18:02:22 +0200 Subject: fix: Another set of various clippy fixes (#246) * fix: Remove unnecessary clone * fix: Remove redundant field name in struct init * fix: Single-char string constant used as pattern * fix: calling `push_str()` using a single-character string literal * fix: this pattern reimplements `Option::unwrap_or` * fix: Remove unnecessary borrow * fix: Remove useless use of `format!` * fix: called `inspect(..).for_each(..)` on an `Iterator` * fix: Formatting --- src-tauri/src/github/mod.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src-tauri/src/github') diff --git a/src-tauri/src/github/mod.rs b/src-tauri/src/github/mod.rs index 87ea629c..c46d7c60 100644 --- a/src-tauri/src/github/mod.rs +++ b/src-tauri/src/github/mod.rs @@ -49,7 +49,7 @@ pub fn get_list_of_tags() -> Result, String> { // Fetch the list of tags for the repository as a `Vec`. let tags_url = format!("https://api.github.com/repos/{}/tags", FLIGHTCORE_REPO_NAME); - let tags: Vec = client.get(&tags_url).send().unwrap().json().unwrap(); + let tags: Vec = client.get(tags_url).send().unwrap().json().unwrap(); // Map each `Tag` element to a `TagWrapper` element with the desired label and `Tag` value. let tag_wrappers: Vec = tags @@ -102,10 +102,15 @@ pub fn compare_tags(first_tag: Tag, second_tag: Tag) -> Result { commit.sha, commit.commit.message.split('\n').next().unwrap() ); - patch_notes.push(format!( - "{}", - commit.commit.message.split('\n').next().unwrap() - )); + patch_notes.push( + commit + .commit + .message + .split('\n') + .next() + .unwrap() + .to_string(), + ); } full_patch_notes += &generate_flightcore_release_notes(patch_notes); @@ -140,7 +145,7 @@ fn generate_flightcore_release_notes(commits: Vec) -> String { release_notes.push_str(&format!("- {}\n", commit_message)); } - release_notes.push_str("\n"); + release_notes.push('\n'); } } } @@ -155,7 +160,7 @@ fn group_commits_by_type(commits: Vec) -> HashMap> { let mut other_commits: Vec = vec![]; for commit in commits { - let commit_parts: Vec<&str> = commit.splitn(2, ":").collect(); + let commit_parts: Vec<&str> = commit.splitn(2, ':').collect(); if commit_parts.len() == 2 { let commit_type = commit_parts[0].to_lowercase(); let commit_description = commit_parts[1].trim().to_string(); -- cgit v1.2.3