chore: bump msrv, fix new clippy warnings & handle os-info update (#7174)

* chore: bump msrv & handle clippy warnings

* chore: handle new os-info symbols
This commit is contained in:
David Knaack
2025-12-26 14:39:50 +01:00
committed by GitHub
parent 048acd1aa7
commit 6e72335c0e
14 changed files with 83 additions and 50 deletions
+14 -2
View File
@@ -1200,6 +1200,7 @@
"Alpaquita": "🔔 ", "Alpaquita": "🔔 ",
"AlmaLinux": "💠 ", "AlmaLinux": "💠 ",
"Alpine": "🏔️ ", "Alpine": "🏔️ ",
"ALTLinux": "Ⓐ ",
"Amazon": "🙂 ", "Amazon": "🙂 ",
"Android": "🤖 ", "Android": "🤖 ",
"AOSC": "🐱 ", "AOSC": "🐱 ",
@@ -1209,6 +1210,7 @@
"CachyOS": "🎗️ ", "CachyOS": "🎗️ ",
"CentOS": "💠 ", "CentOS": "💠 ",
"Debian": "🌀 ", "Debian": "🌀 ",
"Elementary": "🍏 ",
"DragonFly": "🐉 ", "DragonFly": "🐉 ",
"Emscripten": "🔗 ", "Emscripten": "🔗 ",
"EndeavourOS": "🚀 ", "EndeavourOS": "🚀 ",
@@ -1218,6 +1220,8 @@
"Gentoo": "🗜️ ", "Gentoo": "🗜️ ",
"HardenedBSD": "🛡️ ", "HardenedBSD": "🛡️ ",
"Illumos": "🐦 ", "Illumos": "🐦 ",
"Ios": "📱 ",
"InstantOS": "⏲️ ",
"Kali": "🐉 ", "Kali": "🐉 ",
"Linux": "🐧 ", "Linux": "🐧 ",
"Mabox": "📦 ", "Mabox": "📦 ",
@@ -1234,6 +1238,7 @@
"openEuler": "🦉 ", "openEuler": "🦉 ",
"openSUSE": "🦎 ", "openSUSE": "🦎 ",
"OracleLinux": "🦴 ", "OracleLinux": "🦴 ",
"PikaOS": "🐤 ",
"Pop": "🍭 ", "Pop": "🍭 ",
"Raspbian": "🍓 ", "Raspbian": "🍓 ",
"Redhat": "🎩 ", "Redhat": "🎩 ",
@@ -1247,7 +1252,8 @@
"Unknown": "❓ ", "Unknown": "❓ ",
"Uos": "🐲 ", "Uos": "🐲 ",
"Void": " ", "Void": " ",
"Windows": "🪟 " "Windows": "🪟 ",
"Zorin": "🔹 "
}, },
"disabled": true "disabled": true
} }
@@ -5035,6 +5041,7 @@
"Alpaquita": "🔔 ", "Alpaquita": "🔔 ",
"AlmaLinux": "💠 ", "AlmaLinux": "💠 ",
"Alpine": "🏔️ ", "Alpine": "🏔️ ",
"ALTLinux": "Ⓐ ",
"Amazon": "🙂 ", "Amazon": "🙂 ",
"Android": "🤖 ", "Android": "🤖 ",
"AOSC": "🐱 ", "AOSC": "🐱 ",
@@ -5044,6 +5051,7 @@
"CachyOS": "🎗️ ", "CachyOS": "🎗️ ",
"CentOS": "💠 ", "CentOS": "💠 ",
"Debian": "🌀 ", "Debian": "🌀 ",
"Elementary": "🍏 ",
"DragonFly": "🐉 ", "DragonFly": "🐉 ",
"Emscripten": "🔗 ", "Emscripten": "🔗 ",
"EndeavourOS": "🚀 ", "EndeavourOS": "🚀 ",
@@ -5053,6 +5061,8 @@
"Gentoo": "🗜️ ", "Gentoo": "🗜️ ",
"HardenedBSD": "🛡️ ", "HardenedBSD": "🛡️ ",
"Illumos": "🐦 ", "Illumos": "🐦 ",
"Ios": "📱 ",
"InstantOS": "⏲️ ",
"Kali": "🐉 ", "Kali": "🐉 ",
"Linux": "🐧 ", "Linux": "🐧 ",
"Mabox": "📦 ", "Mabox": "📦 ",
@@ -5069,6 +5079,7 @@
"openEuler": "🦉 ", "openEuler": "🦉 ",
"openSUSE": "🦎 ", "openSUSE": "🦎 ",
"OracleLinux": "🦴 ", "OracleLinux": "🦴 ",
"PikaOS": "🐤 ",
"Pop": "🍭 ", "Pop": "🍭 ",
"Raspbian": "🍓 ", "Raspbian": "🍓 ",
"Redhat": "🎩 ", "Redhat": "🎩 ",
@@ -5082,7 +5093,8 @@
"Unknown": "❓ ", "Unknown": "❓ ",
"Uos": "🐲 ", "Uos": "🐲 ",
"Void": " ", "Void": " ",
"Windows": "🪟 " "Windows": "🪟 ",
"Zorin": "🔹 "
} }
}, },
"disabled": { "disabled": {
Generated
+1
View File
@@ -2423,6 +2423,7 @@ dependencies = [
"objc2", "objc2",
"objc2-foundation", "objc2-foundation",
"objc2-ui-kit", "objc2-ui-kit",
"schemars",
"serde", "serde",
"windows-sys 0.61.2", "windows-sys 0.61.2",
] ]
+2 -2
View File
@@ -23,7 +23,7 @@ license = "ISC"
readme = "README.md" readme = "README.md"
repository = "https://github.com/starship/starship" repository = "https://github.com/starship/starship"
# Note: MSRV is only intended as a hint, and only the latest version is officially supported in starship. # Note: MSRV is only intended as a hint, and only the latest version is officially supported in starship.
rust-version = "1.85" rust-version = "1.90"
description = """ description = """
The minimal, blazing-fast, and infinitely customizable prompt for any shell! ☄🌌️ The minimal, blazing-fast, and infinitely customizable prompt for any shell! ☄🌌️
""" """
@@ -52,7 +52,7 @@ notify-rust = { version = "4.11.7", optional = true }
nu-ansi-term = "0.50.3" nu-ansi-term = "0.50.3"
open = "5.3.3" open = "5.3.3"
# update os module config and tests when upgrading os_info # update os module config and tests when upgrading os_info
os_info = "3.14.0" os_info = { version = "3.14.0", features = ["schemars"] }
# for efficient shared state between `git_status` and `git_metrics`, allowing parallel printing. This is for poison-free locks. # for efficient shared state between `git_status` and `git_metrics`, allowing parallel printing. This is for poison-free locks.
parking_lot = "0.12.5" parking_lot = "0.12.5"
path-slash = "0.2.1" path-slash = "0.2.1"
+6
View File
@@ -3522,6 +3522,7 @@ AIX = "➿ "
Alpaquita = "🔔 " Alpaquita = "🔔 "
AlmaLinux = "💠 " AlmaLinux = "💠 "
Alpine = "🏔️ " Alpine = "🏔️ "
ALTLinux = "Ⓐ "
Amazon = "🙂 " Amazon = "🙂 "
Android = "🤖 " Android = "🤖 "
AOSC = "🐱 " AOSC = "🐱 "
@@ -3532,6 +3533,7 @@ CachyOS = "🎗️ "
CentOS = "💠 " CentOS = "💠 "
Debian = "🌀 " Debian = "🌀 "
DragonFly = "🐉 " DragonFly = "🐉 "
Elementary = "🍏 "
Emscripten = "🔗 " Emscripten = "🔗 "
EndeavourOS = "🚀 " EndeavourOS = "🚀 "
Fedora = "🎩 " Fedora = "🎩 "
@@ -3540,6 +3542,8 @@ Garuda = "🦅 "
Gentoo = "🗜️ " Gentoo = "🗜️ "
HardenedBSD = "🛡️ " HardenedBSD = "🛡️ "
Illumos = "🐦 " Illumos = "🐦 "
Ios = "📱 "
InstantOS = "⏲️ "
Kali = "🐉 " Kali = "🐉 "
Linux = "🐧 " Linux = "🐧 "
Mabox = "📦 " Mabox = "📦 "
@@ -3556,6 +3560,7 @@ OpenCloudOS = "☁️ "
openEuler = "🦉 " openEuler = "🦉 "
openSUSE = "🦎 " openSUSE = "🦎 "
OracleLinux = "🦴 " OracleLinux = "🦴 "
PikaOS = "🐤 "
Pop = "🍭 " Pop = "🍭 "
Raspbian = "🍓 " Raspbian = "🍓 "
Redhat = "🎩 " Redhat = "🎩 "
@@ -3570,6 +3575,7 @@ Unknown = "❓ "
Uos = "🐲 " Uos = "🐲 "
Void = " " Void = " "
Windows = "🪟 " Windows = "🪟 "
Zorin = "🔹 "
``` ```
### Variables ### Variables
@@ -124,6 +124,7 @@ CachyOS = " "
CentOS = " " CentOS = " "
Debian = " " Debian = " "
DragonFly = " " DragonFly = " "
Elementary = " "
Emscripten = " " Emscripten = " "
EndeavourOS = " " EndeavourOS = " "
Fedora = " " Fedora = " "
@@ -132,6 +133,7 @@ Garuda = "󰛓 "
Gentoo = " " Gentoo = " "
HardenedBSD = "󰞌 " HardenedBSD = "󰞌 "
Illumos = "󰈸 " Illumos = "󰈸 "
Ios = "󰀷 "
Kali = " " Kali = " "
Linux = " " Linux = " "
Mabox = " " Mabox = " "
@@ -158,6 +160,7 @@ Ubuntu = " "
Unknown = " " Unknown = " "
Void = " " Void = " "
Windows = "󰍲 " Windows = "󰍲 "
Zorin = " "
[package] [package]
symbol = "󰏗 " symbol = "󰏗 "
@@ -193,6 +193,7 @@ AIX = "aix "
Alpaquita = "alq " Alpaquita = "alq "
AlmaLinux = "alma " AlmaLinux = "alma "
Alpine = "alp " Alpine = "alp "
ALTLinux = "alt "
Amazon = "amz " Amazon = "amz "
Android = "andr " Android = "andr "
AOSC = "aosc " AOSC = "aosc "
@@ -203,6 +204,7 @@ CachyOS = "cach "
CentOS = "cent " CentOS = "cent "
Debian = "deb " Debian = "deb "
DragonFly = "dfbsd " DragonFly = "dfbsd "
Elementary = "elem "
Emscripten = "emsc " Emscripten = "emsc "
EndeavourOS = "ndev " EndeavourOS = "ndev "
Fedora = "fed " Fedora = "fed "
@@ -211,6 +213,8 @@ Garuda = "garu "
Gentoo = "gent " Gentoo = "gent "
HardenedBSD = "hbsd " HardenedBSD = "hbsd "
Illumos = "lum " Illumos = "lum "
Ios = "ios "
InstantOS = "inst "
Kali = "kali " Kali = "kali "
Linux = "lnx " Linux = "lnx "
Mabox = "mbox " Mabox = "mbox "
@@ -227,6 +231,7 @@ OpenCloudOS = "ocos "
openEuler = "oeul " openEuler = "oeul "
openSUSE = "osuse " openSUSE = "osuse "
OracleLinux = "orac " OracleLinux = "orac "
PikaOS = "pika "
Pop = "pop " Pop = "pop "
Raspbian = "rasp " Raspbian = "rasp "
Redhat = "rhl " Redhat = "rhl "
@@ -241,6 +246,7 @@ Unknown = "unk "
Uos = "uos " Uos = "uos "
Void = "void " Void = "void "
Windows = "win " Windows = "win "
Zorin = "zorn "
[package] [package]
symbol = "pkg " symbol = "pkg "
+6 -4
View File
@@ -12,7 +12,6 @@ use serde::{Deserialize, Serialize};
pub struct OSConfig<'a> { pub struct OSConfig<'a> {
pub format: &'a str, pub format: &'a str,
pub style: &'a str, pub style: &'a str,
#[cfg_attr(feature = "config-schema", schemars(with = "IndexMap<String, String>"))]
pub symbols: IndexMap<Type, &'a str>, pub symbols: IndexMap<Type, &'a str>,
pub disabled: bool, pub disabled: bool,
} }
@@ -33,6 +32,7 @@ impl Default for OSConfig<'_> {
Type::Alpaquita => "🔔 ", Type::Alpaquita => "🔔 ",
Type::AlmaLinux => "💠 ", Type::AlmaLinux => "💠 ",
Type::Alpine => "🏔️ ", Type::Alpine => "🏔️ ",
Type::ALTLinux => "",
Type::Amazon => "🙂 ", Type::Amazon => "🙂 ",
Type::Android => "🤖 ", Type::Android => "🤖 ",
Type::AOSC => "🐱 ", Type::AOSC => "🐱 ",
@@ -42,6 +42,7 @@ impl Default for OSConfig<'_> {
Type::CachyOS => "🎗️ ", Type::CachyOS => "🎗️ ",
Type::CentOS => "💠 ", Type::CentOS => "💠 ",
Type::Debian => "🌀 ", Type::Debian => "🌀 ",
Type::Elementary => "🍏 ",
Type::DragonFly => "🐉 ", Type::DragonFly => "🐉 ",
Type::Emscripten => "🔗 ", Type::Emscripten => "🔗 ",
Type::EndeavourOS => "🚀 ", Type::EndeavourOS => "🚀 ",
@@ -51,6 +52,8 @@ impl Default for OSConfig<'_> {
Type::Gentoo => "🗜️ ", Type::Gentoo => "🗜️ ",
Type::HardenedBSD => "🛡️ ", Type::HardenedBSD => "🛡️ ",
Type::Illumos => "🐦 ", Type::Illumos => "🐦 ",
Type::Ios => "📱 ",
Type::InstantOS => "⏲️ ",
Type::Kali => "🐉 ", Type::Kali => "🐉 ",
Type::Linux => "🐧 ", Type::Linux => "🐧 ",
Type::Mabox => "📦 ", Type::Mabox => "📦 ",
@@ -67,6 +70,7 @@ impl Default for OSConfig<'_> {
Type::openEuler => "🦉 ", Type::openEuler => "🦉 ",
Type::openSUSE => "🦎 ", Type::openSUSE => "🦎 ",
Type::OracleLinux => "🦴 ", Type::OracleLinux => "🦴 ",
Type::PikaOS => "🐤 ",
Type::Pop => "🍭 ", Type::Pop => "🍭 ",
Type::Raspbian => "🍓 ", Type::Raspbian => "🍓 ",
Type::Redhat => "🎩 ", Type::Redhat => "🎩 ",
@@ -81,12 +85,10 @@ impl Default for OSConfig<'_> {
Type::Uos => "🐲 ", Type::Uos => "🐲 ",
Type::Void => "", Type::Void => "",
Type::Windows => "🪟 ", Type::Windows => "🪟 ",
Type::Zorin => "🔹 ",
// Future symbols. // Future symbols.
//aosc => " ",
//artix => " ",
//coreos => " ", //coreos => " ",
//devuan => " ", //devuan => " ",
//elementary => " ",
//mageia => " ", //mageia => " ",
//mandriva => " ", //mandriva => " ",
//sabayon => " ", //sabayon => " ",
+4 -4
View File
@@ -498,10 +498,10 @@ pub enum Detected {
} }
fn home_dir(env: &Env) -> Option<PathBuf> { fn home_dir(env: &Env) -> Option<PathBuf> {
if cfg!(test) { if cfg!(test)
if let Some(home) = env.get_env("HOME") { && let Some(home) = env.get_env("HOME")
return Some(PathBuf::from(home)); {
} return Some(PathBuf::from(home));
} }
utils::home_dir() utils::home_dir()
} }
+5 -4
View File
@@ -28,10 +28,11 @@ pub fn module<'a>(name: &str, context: &'a Context) -> Option<Module<'a>> {
return None; return None;
} }
if let Some(os) = config.os { if let Some(os) = config.os
if os != env::consts::OS && !(os == "unix" && cfg!(unix)) { && os != env::consts::OS
return None; && !(os == "unix" && cfg!(unix))
} {
return None;
} }
if config.require_repo && context.get_repo().is_err() { if config.require_repo && context.get_repo().is_err() {
+13 -13
View File
@@ -348,22 +348,22 @@ fn get_repo_status(
let has_ahead_behind = !config.ahead.is_empty() || !config.behind.is_empty(); let has_ahead_behind = !config.ahead.is_empty() || !config.behind.is_empty();
let has_up_to_date_or_diverged = let has_up_to_date_or_diverged =
!config.up_to_date.is_empty() || !config.diverged.is_empty(); !config.up_to_date.is_empty() || !config.diverged.is_empty();
if has_ahead_behind || has_up_to_date_or_diverged { if (has_ahead_behind || has_up_to_date_or_diverged)
if let Some(branch_name) = gix_repo.head_name().ok().flatten().and_then(|ref_name| { && let Some(branch_name) = gix_repo.head_name().ok().flatten().and_then(|ref_name| {
Vec::from(gix::bstr::BString::from(ref_name)) Vec::from(gix::bstr::BString::from(ref_name))
.into_string() .into_string()
.ok() .ok()
}) { })
let output = repo.exec_git( {
context, let output = repo.exec_git(
["for-each-ref", "--format", "%(upstream) %(upstream:track)"] context,
.into_iter() ["for-each-ref", "--format", "%(upstream) %(upstream:track)"]
.map(ToOwned::to_owned) .into_iter()
.chain(Some(branch_name)), .map(ToOwned::to_owned)
)?; .chain(Some(branch_name)),
if let Some(line) = output.stdout.lines().next() { )?;
repo_status.set_ahead_behind_for_each_ref(line); if let Some(line) = output.stdout.lines().next() {
} repo_status.set_ahead_behind_for_each_ref(line);
} }
} }
+2 -3
View File
@@ -93,10 +93,9 @@ fn get_wrapper_properties_file(context: &Context, recursive: bool) -> Option<Str
.try_begin_scan()? .try_begin_scan()?
.set_folders(&["gradle"]) .set_folders(&["gradle"])
.is_match() .is_match()
&& let Some(properties) = read_wrapper_properties(&context.current_dir)
{ {
if let Some(properties) = read_wrapper_properties(&context.current_dir) { return Some(properties);
return Some(properties);
}
} }
// Try parent directories if recursive // Try parent directories if recursive
+3 -5
View File
@@ -28,11 +28,9 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
.inspect_err(|e| log::warn!("Failed to get hostname: {e}")) .inspect_err(|e| log::warn!("Failed to get hostname: {e}"))
.ok()?; .ok()?;
//rustc doesn't let you do an "if" and an "if let" in the same if statement let mut host = if !config.trim_at.is_empty()
// if this changes in the future this can become a lot cleaner && let Some(index) = host.find(config.trim_at)
let mut host = if config.trim_at.is_empty() { {
host.as_ref()
} else if let Some(index) = host.find(config.trim_at) {
host.split_at(index).0 host.split_at(index).0
} else { } else {
host.as_ref() host.as_ref()
+6
View File
@@ -338,6 +338,7 @@ mod tests {
Type::AIX => "", Type::AIX => "",
Type::Alpaquita => "🔔 ", Type::Alpaquita => "🔔 ",
Type::Alpine => "🏔️ ", Type::Alpine => "🏔️ ",
Type::ALTLinux => "",
Type::Amazon => "🙂 ", Type::Amazon => "🙂 ",
Type::Android => "🤖 ", Type::Android => "🤖 ",
Type::AOSC => "🐱 ", Type::AOSC => "🐱 ",
@@ -347,6 +348,7 @@ mod tests {
Type::Cygwin => "", Type::Cygwin => "",
Type::Debian => "🌀 ", Type::Debian => "🌀 ",
Type::DragonFly => "🐉 ", Type::DragonFly => "🐉 ",
Type::Elementary => "🍏 ",
Type::Emscripten => "🔗 ", Type::Emscripten => "🔗 ",
Type::EndeavourOS => "🚀 ", Type::EndeavourOS => "🚀 ",
Type::Fedora | Type::Nobara | Type::Redhat | Type::RedHatEnterprise => "🎩 ", Type::Fedora | Type::Nobara | Type::Redhat | Type::RedHatEnterprise => "🎩 ",
@@ -355,6 +357,8 @@ mod tests {
Type::Gentoo => "🗜️ ", Type::Gentoo => "🗜️ ",
Type::HardenedBSD => "🛡️ ", Type::HardenedBSD => "🛡️ ",
Type::Illumos => "🐦 ", Type::Illumos => "🐦 ",
Type::Ios => "📱 ",
Type::InstantOS => "⏲️ ",
Type::Kali => "🐉 ", Type::Kali => "🐉 ",
Type::Linux => "🐧 ", Type::Linux => "🐧 ",
Type::Mabox => "📦 ", Type::Mabox => "📦 ",
@@ -370,6 +374,7 @@ mod tests {
Type::openEuler => "🦉 ", Type::openEuler => "🦉 ",
Type::openSUSE => "🦎 ", Type::openSUSE => "🦎 ",
Type::OracleLinux => "🦴 ", Type::OracleLinux => "🦴 ",
Type::PikaOS => "🐤 ",
Type::Pop => "🍭 ", Type::Pop => "🍭 ",
Type::Raspbian => "🍓 ", Type::Raspbian => "🍓 ",
Type::Redox => "🧪 ", Type::Redox => "🧪 ",
@@ -381,6 +386,7 @@ mod tests {
Type::Uos => "🐲 ", Type::Uos => "🐲 ",
Type::Void => "", Type::Void => "",
Type::Windows => "🪟 ", Type::Windows => "🪟 ",
Type::Zorin => "🔹 ",
_ => "", _ => "",
}; };
} }
+12 -13
View File
@@ -333,19 +333,17 @@ fn find_rust_toolchain_file(context: &Context) -> Option<String> {
if context if context
.dir_contents() .dir_contents()
.is_ok_and(|dir| dir.has_file("rust-toolchain")) .is_ok_and(|dir| dir.has_file("rust-toolchain"))
&& let Some(toolchain) = read_channel(Path::new("rust-toolchain"), false)
{ {
if let Some(toolchain) = read_channel(Path::new("rust-toolchain"), false) { return Some(toolchain);
return Some(toolchain);
}
} }
if context if context
.dir_contents() .dir_contents()
.is_ok_and(|dir| dir.has_file("rust-toolchain.toml")) .is_ok_and(|dir| dir.has_file("rust-toolchain.toml"))
&& let Some(toolchain) = read_channel(Path::new("rust-toolchain.toml"), true)
{ {
if let Some(toolchain) = read_channel(Path::new("rust-toolchain.toml"), true) { return Some(toolchain);
return Some(toolchain);
}
} }
let mut dir = &*context.current_dir; let mut dir = &*context.current_dir;
@@ -365,13 +363,14 @@ fn extract_toolchain_from_rustup_run_rustc_version(output: Output) -> RustupRunR
if let Ok(output) = String::from_utf8(output.stdout) { if let Ok(output) = String::from_utf8(output.stdout) {
return RustupRunRustcVersionOutcome::RustcVersion(output); return RustupRunRustcVersionOutcome::RustcVersion(output);
} }
} else if let Ok(stderr) = String::from_utf8(output.stderr) { } else if let Ok(stderr) = String::from_utf8(output.stderr)
if stderr.starts_with("error: toolchain '") && stderr.ends_with("' is not installed\n") { && stderr.starts_with("error: toolchain '")
let stderr = stderr && stderr.ends_with("' is not installed\n")
["error: toolchain '".len()..stderr.len() - "' is not installed\n".len()] {
.to_owned(); let stderr = stderr
return RustupRunRustcVersionOutcome::ToolchainNotInstalled(stderr); ["error: toolchain '".len()..stderr.len() - "' is not installed\n".len()]
} .to_owned();
return RustupRunRustcVersionOutcome::ToolchainNotInstalled(stderr);
} }
RustupRunRustcVersionOutcome::Err RustupRunRustcVersionOutcome::Err
} }