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