From 891df0147504de002290bd9e5251d7a66ed5245d Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sun, 23 Jan 2022 17:47:28 +0100 Subject: [PATCH 1/5] Bump rust edition to 2021 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 6ede347..108b547 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "gluebuddy" version = "0.1.0" authors = ["Levente Polyak ", "Sven-Hendrik Haase "] -edition = "2018" +edition = "2021" license-file = "LICENSE" repository = "https://gitlab.archlinux.org/archlinux/gluebuddy" categories = ["command-line-utilities"] -- GitLab From 8e7a73fc9790f8090cc383f3d87b8f844979d242 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sun, 23 Jan 2022 17:54:11 +0100 Subject: [PATCH 2/5] chore: fix if-let clippy warnings --- src/main.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index cf991f4..9d08c1d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,12 +20,9 @@ use tokio::sync::Mutex; async fn run(args: Args) -> Result<()> { /* Early exit for completions */ - match args.command { - Command::Completions(completions) => { + if let Command::Completions(completions) = args.command { args::gen_completions(&completions)?; return Ok(()); - } - _ => {} } let state = Arc::new(Mutex::new(State::default())); -- GitLab From 8dcc83b97ff87cfeeb567d4668123d9169cdacd5 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sun, 23 Jan 2022 17:55:38 +0100 Subject: [PATCH 3/5] chore: fix use the original iterator clippy warning --- src/components/keycloak/keycloak.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/keycloak/keycloak.rs b/src/components/keycloak/keycloak.rs index 85746e7..355d5fa 100644 --- a/src/components/keycloak/keycloak.rs +++ b/src/components/keycloak/keycloak.rs @@ -116,8 +116,7 @@ impl Keycloak { .await?; let groups = all_groups .iter() - .filter(|group| root_groups.contains(&group.name.as_ref().unwrap().as_ref())) - .collect::>(); + .filter(|group| root_groups.contains(&group.name.as_ref().unwrap().as_ref())); let groups_members = groups.into_iter().flat_map(|group| { let group_name = group.name.as_ref().unwrap(); -- GitLab From 6f38fbfb25cfe9520d8a3005c9335b41fe9df382 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sun, 23 Jan 2022 17:59:59 +0100 Subject: [PATCH 4/5] chore: remove redundant clone --- src/util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.rs b/src/util.rs index ebaed91..b82dee9 100644 --- a/src/util.rs +++ b/src/util.rs @@ -95,5 +95,5 @@ pub fn format_gitlab_project_settings( } pub fn format_separator() -> String { - "-".repeat(72).to_string() + "-".repeat(72) } -- GitLab From 11091ee1baf82df4575dd0b6ba9e00ae576b671a Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sun, 23 Jan 2022 18:02:53 +0100 Subject: [PATCH 5/5] chore: fix needless borrows found by clippy --- src/components/gitlab/gitlab.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/gitlab/gitlab.rs b/src/components/gitlab/gitlab.rs index 4797d1c..3472389 100644 --- a/src/components/gitlab/gitlab.rs +++ b/src/components/gitlab/gitlab.rs @@ -142,7 +142,7 @@ impl GitLabGlue { let mut summary = PlanSummary::new(&label); let members = self.get_group_members(&group.full_path).await?; for member in &members { - if is_archlinux_bot(&member) { + if is_archlinux_bot(member) { continue; } @@ -199,7 +199,7 @@ impl GitLabGlue { .await?; for member in &members { - if is_archlinux_bot(&member) { + if is_archlinux_bot(member) { continue; } @@ -258,7 +258,7 @@ impl GitLabGlue { for staff in state.staff() { if !gitlab_group_member_names.contains(&staff.username) && self - .add_group_member(action, &staff, group, DEFAULT_ARCH_LINUX_GROUP_ACCESS_LEVEL) + .add_group_member(action, staff, group, DEFAULT_ARCH_LINUX_GROUP_ACCESS_LEVEL) .await? { summary.add += 1; @@ -266,7 +266,7 @@ impl GitLabGlue { } for member in &archlinux_group_members { - if is_archlinux_bot(&member) { + if is_archlinux_bot(member) { continue; } match state.staff_from_gitlab_id(member.id) { @@ -316,7 +316,7 @@ impl GitLabGlue { for staff in state.staff() { if !gitlab_group_member_names.contains(&staff.username) && self - .add_group_member(action, &staff, group, DEFAULT_STAFF_GROUP_ACCESS_LEVEL) + .add_group_member(action, staff, group, DEFAULT_STAFF_GROUP_ACCESS_LEVEL) .await? { summary.add += 1; @@ -324,7 +324,7 @@ impl GitLabGlue { } for member in &archlinux_group_members { - if is_archlinux_bot(&member) { + if is_archlinux_bot(member) { continue; } match state.staff_from_gitlab_id(member.id) { @@ -375,7 +375,7 @@ impl GitLabGlue { && self .add_group_member( action, - &staff, + staff, devops_group, DEVOPS_INFRASTRUCTURE_ACCESS_LEVEL, ) @@ -386,7 +386,7 @@ impl GitLabGlue { } for member in &group_members { - if is_archlinux_bot(&member) { + if is_archlinux_bot(member) { continue; } match state.devops_from_gitlab_id(member.id) { @@ -511,7 +511,7 @@ impl GitLabGlue { debug!("Adding user {} to GitLab group '{}'", user.username, group); util::print_diff( - &"", + "", util::format_gitlab_member_access(group, &user.username, access_level).as_str(), )?; match action { @@ -547,7 +547,7 @@ impl GitLabGlue { util::access_level_from_u64(member.access_level), ) .as_str(), - &"", + "", )?; match action { Action::Apply => { @@ -663,7 +663,7 @@ impl GitLabGlue { user.username, project ); util::print_diff( - &"", + "", util::format_gitlab_member_access(project, &user.username, access_level).as_str(), )?; match action { @@ -701,7 +701,7 @@ impl GitLabGlue { util::access_level_from_u64(member.access_level), ) .as_str(), - &"", + "", )?; match action { Action::Apply => { -- GitLab