Skip to content
Merged
Changes from 1 commit
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
8 changes: 5 additions & 3 deletions src/backend/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ pub fn platform_aliases() -> Vec<(String, String)> {

/// Looks up a value in a BTreeMap using all possible platform key aliases.
/// Example: for key_type = "url", will check platform_macos_x64_url, platform_darwin_amd64_url, etc.
/// Also supports both "platforms_" and "platform_" prefixes.
pub fn lookup_platform_key<'a>(
opts: &'a BTreeMap<String, String>,
key_type: &str,
) -> Option<&'a String> {
for (os, arch) in platform_aliases() {
let key = format!("platform_{os}_{arch}_{key_type}");
if let Some(val) = opts.get(&key) {
return Some(val);
for prefix in ["platforms", "platform"] {

Copilot AI Jul 13, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider extracting the prefix array into a named constant (e.g., const PREFIXES: [&str; 2] = ["platforms", "platform"];) to improve readability and avoid repeated literals.

Suggested change
for prefix in ["platforms", "platform"] {
for prefix in PREFIXES {

Copilot uses AI. Check for mistakes.
if let Some(val) = opts.get(&format!("{prefix}_{os}_{arch}_{key_type}")) {
return Some(val);
}
}
}
None
Expand Down
Loading