From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id B01521FF173 for ; Mon, 13 Jan 2025 15:28:21 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1B619FB6; Mon, 13 Jan 2025 15:28:02 +0100 (CET) From: Maximiliano Sandoval To: pdm-devel@lists.proxmox.com Date: Mon, 13 Jan 2025 15:27:14 +0100 Message-Id: <20250113142725.523748-4-m.sandoval@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250113142725.523748-1-m.sandoval@proxmox.com> References: <20250113142725.523748-1-m.sandoval@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.054 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_SBL_A 0.1 Contains URL's A record listed in the Spamhaus SBL blocklist [185.199.110.153, 185.199.109.153, 185.199.111.153, 185.199.108.153] Subject: [pdm-devel] [PATCH proxmox-yew-comp 04/15] apt_repositories: collapse else-if blocks X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" Fixes: warning: this `else { if .. }` block can be collapsed --> src/apt_repositories.rs:151:12 | 151 | } else { | ____________^ 152 | | if config.errors.is_empty() { 153 | | // just avoid that we show "get updates" 154 | | if has_test || has_no_subscription { ... | 165 | | } 166 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if = note: `#[warn(clippy::collapsible_else_if)]` on by default help: collapse nested if block | 151 ~ } else if config.errors.is_empty() { 152 + // just avoid that we show "get updates" 153 + if has_test || has_no_subscription { 154 + list.push(StatusLine::ok(tr!( 155 + "You get updates for {0}", 156 + product.project_text() 157 + ))); 158 + } else if has_enterprise && active_subscription { 159 + list.push(StatusLine::ok(tr!( 160 + "You get supported updates for {0}", 161 + product.project_text() 162 + ))); 163 + } 164 + } | Signed-off-by: Maximiliano Sandoval --- src/apt_repositories.rs | 43 +++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/src/apt_repositories.rs b/src/apt_repositories.rs index 534d642..8e6207f 100644 --- a/src/apt_repositories.rs +++ b/src/apt_repositories.rs @@ -148,20 +148,18 @@ fn update_status_store( "No {0} repository is enabled, you do not get any updates!", product.project_text() ))); - } else { - if config.errors.is_empty() { - // just avoid that we show "get updates" - if has_test || has_no_subscription { - list.push(StatusLine::ok(tr!( - "You get updates for {0}", - product.project_text() - ))); - } else if has_enterprise && active_subscription { - list.push(StatusLine::ok(tr!( - "You get supported updates for {0}", - product.project_text() - ))); - } + } else if config.errors.is_empty() { + // just avoid that we show "get updates" + if has_test || has_no_subscription { + list.push(StatusLine::ok(tr!( + "You get updates for {0}", + product.project_text() + ))); + } else if has_enterprise && active_subscription { + list.push(StatusLine::ok(tr!( + "You get supported updates for {0}", + product.project_text() + ))); } } @@ -186,20 +184,19 @@ fn update_status_store( ignore_pre_upgrade_warning.insert((&info.path, info.index)); check_mixed_suites = true; } - if info.kind == "origin" { - if info.message == "Debian" || info.message == "Proxmox" { - controlled_origin.insert((&info.path, info.index)); - } + if info.kind == "origin" && (info.message == "Debian" || info.message == "Proxmox") { + controlled_origin.insert((&info.path, info.index)); } } let mut suites_warning = false; for info in &config.infos { - if info.kind == "warning" && info.property.as_deref() == Some("Suites") { - if enabled_repos.contains(&(&info.path, info.index)) { - suites_warning = true; - break; - } + if info.kind == "warning" + && info.property.as_deref() == Some("Suites") + && enabled_repos.contains(&(&info.path, info.index)) + { + suites_warning = true; + break; } } -- 2.39.5 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel