mirror of
https://github.com/starship/starship.git
synced 2026-06-21 02:02:14 +07:00
chore: handle current compiler & clippy warnings (#7051)
This commit is contained in:
+2
-7
@@ -625,9 +625,10 @@ mod tests {
|
||||
pub switch_c: Switch,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
#[derive(Debug, PartialEq, Clone, Default)]
|
||||
enum Switch {
|
||||
On,
|
||||
#[default]
|
||||
Off,
|
||||
}
|
||||
|
||||
@@ -644,12 +645,6 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Switch {
|
||||
fn default() -> Self {
|
||||
Self::Off
|
||||
}
|
||||
}
|
||||
|
||||
let config = toml::toml! {
|
||||
switch_a = "on"
|
||||
switch_b = "any"
|
||||
|
||||
+3
-3
@@ -552,9 +552,9 @@ impl DirContents {
|
||||
|
||||
{
|
||||
let worker = move || {
|
||||
let enumerated_dir = fs::read_dir(base).unwrap().enumerate();
|
||||
let _ = enumerated_dir
|
||||
.filter_map(|(_, entry)| entry.ok())
|
||||
let dir_iter = fs::read_dir(base).unwrap();
|
||||
let _ = dir_iter
|
||||
.filter_map(|entry| entry.ok())
|
||||
.try_for_each(|entry| tx.send(entry));
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ pub enum FormatElement<'a> {
|
||||
Text(Cow<'a, str>),
|
||||
Variable(Cow<'a, str>),
|
||||
TextGroup(TextGroup<'a>),
|
||||
Conditional(Vec<FormatElement<'a>>),
|
||||
Conditional(Vec<Self>),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
||||
@@ -391,9 +391,10 @@ impl<'a> StringFormatter<'a> {
|
||||
match format_element {
|
||||
// Should not usually happen, but if it does, check if the variable
|
||||
// is set using `should_show_elements`.
|
||||
FormatElement::Variable(_) => {
|
||||
should_show_elements(&[format_element.clone()], variables)
|
||||
}
|
||||
FormatElement::Variable(_) => should_show_elements(
|
||||
std::slice::from_ref(format_element),
|
||||
variables,
|
||||
),
|
||||
FormatElement::Conditional(format) => {
|
||||
should_show_elements(format, variables)
|
||||
}
|
||||
|
||||
@@ -306,8 +306,7 @@ fn get_latest_sdk_from_cli(context: &Context) -> Option<String> {
|
||||
.stdout
|
||||
.lines()
|
||||
.map(str::trim)
|
||||
.filter(|l| !l.is_empty())
|
||||
.next_back()
|
||||
.rfind(|l| !l.is_empty())
|
||||
.or_else(parse_failed)?;
|
||||
let take_until = latest_sdk.find('[').or_else(parse_failed)? - 1;
|
||||
if take_until > 1 {
|
||||
|
||||
@@ -51,7 +51,7 @@ mod normalize {
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub fn normalize_path(path: &Path) -> (NormalizedPrefix, &Path) {
|
||||
pub fn normalize_path(path: &Path) -> (NormalizedPrefix<'_>, &Path) {
|
||||
let mut components = path.components();
|
||||
if let Some(Component::Prefix(prefix)) = components.next() {
|
||||
return (normalize_prefix(prefix.kind()), components.as_path());
|
||||
|
||||
Reference in New Issue
Block a user