1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-28 07:46:28 +00:00

chore: fix new clippy lints (#5241)

This commit is contained in:
David Knaack 2023-06-14 00:06:04 +02:00 committed by GitHub
parent 847a642d6a
commit 796a582f3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -219,7 +219,7 @@ fn handle_toggle_configuration(doc: &mut Document, name: &str, key: &str) -> Res
pub fn get_configuration(context: &Context) -> toml::Table { pub fn get_configuration(context: &Context) -> toml::Table {
let starship_config = StarshipConfig::initialize(&context.get_config_path_os()); let starship_config = StarshipConfig::initialize(&context.get_config_path_os());
starship_config.config.unwrap_or(toml::Table::new()) starship_config.config.unwrap_or_default()
} }
pub fn get_configuration_edit(context: &Context) -> Document { pub fn get_configuration_edit(context: &Context) -> Document {

View File

@ -179,7 +179,7 @@ mod test {
let expected_specified = Some(format!("{} ", Color::Green.bold().paint("V"))); let expected_specified = Some(format!("{} ", Color::Green.bold().paint("V")));
let expected_visual = Some(format!("{} ", Color::Yellow.bold().paint(""))); let expected_visual = Some(format!("{} ", Color::Yellow.bold().paint("")));
let expected_replace = Some(format!("{} ", Color::Purple.bold().paint(""))); let expected_replace = Some(format!("{} ", Color::Purple.bold().paint("")));
let expected_replace_one = expected_replace.clone(); let expected_replace_one = expected_replace.as_deref();
let expected_other = Some(format!("{} ", Color::Green.bold().paint(""))); let expected_other = Some(format!("{} ", Color::Green.bold().paint("")));
// fish keymap is default // fish keymap is default
@ -219,7 +219,7 @@ mod test {
.shell(Shell::Fish) .shell(Shell::Fish)
.keymap("replace_one") .keymap("replace_one")
.collect(); .collect();
assert_eq!(expected_replace_one, actual); assert_eq!(expected_replace_one, actual.as_deref());
// fish keymap is other // fish keymap is other
let actual = ModuleRenderer::new("character") let actual = ModuleRenderer::new("character")

View File

@ -83,7 +83,7 @@ mod tests {
macro_rules! get_hostname { macro_rules! get_hostname {
() => { () => {
if let Some(hostname) = gethostname::gethostname().into_string().ok() { if let Ok(hostname) = gethostname::gethostname().into_string() {
hostname hostname
} else { } else {
println!( println!(

View File

@ -226,7 +226,7 @@ mod tests {
"3.12.0", "3.12.0",
]; ];
for input in inputs.iter() { for input in &inputs {
assert_eq!(parse_version(input), expected); assert_eq!(parse_version(input), expected);
} }
} }
@ -243,7 +243,7 @@ mod tests {
"3.12.0-alpha", "3.12.0-alpha",
]; ];
for input in inputs.iter() { for input in &inputs {
assert_eq!(parse_version(input), expected); assert_eq!(parse_version(input), expected);
} }
} }
@ -260,7 +260,7 @@ mod tests {
"3.12.0-alpha.1630554544+f89e9a29.dirty", "3.12.0-alpha.1630554544+f89e9a29.dirty",
]; ];
for input in inputs.iter() { for input in &inputs {
assert_eq!(parse_version(input), expected); assert_eq!(parse_version(input), expected);
} }
} }