mirror of
https://github.com/starship/starship.git
synced 2026-06-24 02:01:36 +07:00
chore: fix new clippy lints (#4557)
This commit is contained in:
+54
-54
@@ -437,7 +437,7 @@ fn git_status_wsl(context: &Context, conf: &GitStatusConfig) -> Option<String> {
|
||||
crate::config::get_config_path().unwrap_or_else(|| "/dev/null".to_string()),
|
||||
)
|
||||
.env("WSLENV", wslenv)
|
||||
.args(&["module", "git_status", "--path", winpath]);
|
||||
.args(["module", "git_status", "--path", winpath]);
|
||||
c
|
||||
})
|
||||
.and_then(|mut c| c.output())
|
||||
@@ -483,7 +483,7 @@ mod tests {
|
||||
fn format_output(symbols: &str) -> Option<String> {
|
||||
Some(format!(
|
||||
"{} ",
|
||||
Color::Red.bold().paint(format!("[{}]", symbols))
|
||||
Color::Red.bold().paint(format!("[{symbols}]"))
|
||||
))
|
||||
}
|
||||
|
||||
@@ -542,7 +542,7 @@ mod tests {
|
||||
ahead(repo_dir.path())?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("⇡");
|
||||
|
||||
@@ -562,7 +562,7 @@ mod tests {
|
||||
[git_status]
|
||||
ahead="⇡$count"
|
||||
})
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("⇡1");
|
||||
|
||||
@@ -577,7 +577,7 @@ mod tests {
|
||||
diverge(repo_dir.path())?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("⇕");
|
||||
|
||||
@@ -596,7 +596,7 @@ mod tests {
|
||||
[git_status]
|
||||
diverged=r"⇕⇡$ahead_count⇣$behind_count"
|
||||
})
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("⇕⇡1⇣1");
|
||||
|
||||
@@ -613,7 +613,7 @@ mod tests {
|
||||
[git_status]
|
||||
up_to_date="✓"
|
||||
})
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("✓");
|
||||
|
||||
@@ -628,7 +628,7 @@ mod tests {
|
||||
create_conflict(repo_dir.path())?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("=");
|
||||
|
||||
@@ -647,7 +647,7 @@ mod tests {
|
||||
[git_status]
|
||||
conflicted = "=$count"
|
||||
})
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("=1");
|
||||
|
||||
@@ -662,7 +662,7 @@ mod tests {
|
||||
create_untracked(repo_dir.path())?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("?");
|
||||
|
||||
@@ -681,7 +681,7 @@ mod tests {
|
||||
[git_status]
|
||||
untracked = "?$count"
|
||||
})
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("?1");
|
||||
|
||||
@@ -696,12 +696,12 @@ mod tests {
|
||||
create_untracked(repo_dir.path())?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["config", "status.showUntrackedFiles", "no"])
|
||||
.args(["config", "status.showUntrackedFiles", "no"])
|
||||
.current_dir(repo_dir.path())
|
||||
.output()?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = None;
|
||||
|
||||
@@ -716,12 +716,12 @@ mod tests {
|
||||
create_stash(repo_dir.path())?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["reset", "--hard", "HEAD"])
|
||||
.args(["reset", "--hard", "HEAD"])
|
||||
.current_dir(repo_dir.path())
|
||||
.output()?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("$");
|
||||
|
||||
@@ -736,7 +736,7 @@ mod tests {
|
||||
create_stash(repo_dir.path())?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["reset", "--hard", "HEAD"])
|
||||
.args(["reset", "--hard", "HEAD"])
|
||||
.current_dir(repo_dir.path())
|
||||
.output()?;
|
||||
|
||||
@@ -745,7 +745,7 @@ mod tests {
|
||||
[git_status]
|
||||
stashed = r"\$$count"
|
||||
})
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("$1");
|
||||
|
||||
@@ -760,7 +760,7 @@ mod tests {
|
||||
create_modified(repo_dir.path())?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("!");
|
||||
|
||||
@@ -779,7 +779,7 @@ mod tests {
|
||||
[git_status]
|
||||
modified = "!$count"
|
||||
})
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("!1");
|
||||
|
||||
@@ -794,7 +794,7 @@ mod tests {
|
||||
create_added(repo_dir.path())?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("!");
|
||||
|
||||
@@ -809,7 +809,7 @@ mod tests {
|
||||
create_staged(repo_dir.path())?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("+");
|
||||
|
||||
@@ -828,7 +828,7 @@ mod tests {
|
||||
[git_status]
|
||||
staged = "+[$count](green)"
|
||||
})
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = Some(format!(
|
||||
"{} ",
|
||||
@@ -850,7 +850,7 @@ mod tests {
|
||||
create_staged_and_modified(repo_dir.path())?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("!+");
|
||||
|
||||
@@ -865,7 +865,7 @@ mod tests {
|
||||
create_renamed(repo_dir.path())?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("»");
|
||||
|
||||
@@ -884,7 +884,7 @@ mod tests {
|
||||
[git_status]
|
||||
renamed = "»$count"
|
||||
})
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("»1");
|
||||
|
||||
@@ -899,7 +899,7 @@ mod tests {
|
||||
create_renamed_and_modified(repo_dir.path())?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("»!");
|
||||
|
||||
@@ -914,7 +914,7 @@ mod tests {
|
||||
create_deleted(repo_dir.path())?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("✘");
|
||||
|
||||
@@ -933,7 +933,7 @@ mod tests {
|
||||
[git_status]
|
||||
deleted = "✘$count"
|
||||
})
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("✘1");
|
||||
|
||||
@@ -948,7 +948,7 @@ mod tests {
|
||||
create_staged_and_ignored(repo_dir.path())?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("+");
|
||||
|
||||
@@ -962,7 +962,7 @@ mod tests {
|
||||
let repo_dir = fixture_repo(FixtureProvider::Git)?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&[
|
||||
.args([
|
||||
OsStr::new("config"),
|
||||
OsStr::new("core.worktree"),
|
||||
worktree_dir.path().as_os_str(),
|
||||
@@ -973,7 +973,7 @@ mod tests {
|
||||
File::create(worktree_dir.path().join("test_file"))?.sync_all()?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.collect();
|
||||
let expected = format_output("✘?");
|
||||
|
||||
@@ -992,19 +992,19 @@ mod tests {
|
||||
File::create(repo_dir.path().join("a"))?.sync_all()?;
|
||||
File::create(repo_dir.path().join("b"))?.sync_all()?;
|
||||
create_command("git")?
|
||||
.args(&["add", "--all"])
|
||||
.current_dir(&repo_dir.path())
|
||||
.args(["add", "--all"])
|
||||
.current_dir(repo_dir.path())
|
||||
.output()?;
|
||||
create_command("git")?
|
||||
.args(&["commit", "-m", "add new files", "--no-gpg-sign"])
|
||||
.current_dir(&repo_dir.path())
|
||||
.args(["commit", "-m", "add new files", "--no-gpg-sign"])
|
||||
.current_dir(repo_dir.path())
|
||||
.output()?;
|
||||
|
||||
fs::remove_file(repo_dir.path().join("a"))?;
|
||||
fs::rename(repo_dir.path().join("b"), repo_dir.path().join("c"))?;
|
||||
|
||||
let actual = ModuleRenderer::new("git_status")
|
||||
.path(&repo_dir.path())
|
||||
.path(repo_dir.path())
|
||||
.config(toml::toml! {
|
||||
[git_status]
|
||||
ahead = "A"
|
||||
@@ -1024,8 +1024,8 @@ mod tests {
|
||||
File::create(repo_dir.join("readme.md"))?.sync_all()?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["commit", "-am", "Update readme", "--no-gpg-sign"])
|
||||
.current_dir(&repo_dir)
|
||||
.args(["commit", "-am", "Update readme", "--no-gpg-sign"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
Ok(())
|
||||
@@ -1033,7 +1033,7 @@ mod tests {
|
||||
|
||||
fn behind(repo_dir: &Path) -> io::Result<()> {
|
||||
create_command("git")?
|
||||
.args(&["reset", "--hard", "HEAD^"])
|
||||
.args(["reset", "--hard", "HEAD^"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
@@ -1042,14 +1042,14 @@ mod tests {
|
||||
|
||||
fn diverge(repo_dir: &Path) -> io::Result<()> {
|
||||
create_command("git")?
|
||||
.args(&["reset", "--hard", "HEAD^"])
|
||||
.args(["reset", "--hard", "HEAD^"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
fs::write(repo_dir.join("Cargo.toml"), " ")?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["commit", "-am", "Update readme", "--no-gpg-sign"])
|
||||
.args(["commit", "-am", "Update readme", "--no-gpg-sign"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
@@ -1058,24 +1058,24 @@ mod tests {
|
||||
|
||||
fn create_conflict(repo_dir: &Path) -> io::Result<()> {
|
||||
create_command("git")?
|
||||
.args(&["reset", "--hard", "HEAD^"])
|
||||
.args(["reset", "--hard", "HEAD^"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
fs::write(repo_dir.join("readme.md"), "# goodbye")?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["add", "."])
|
||||
.args(["add", "."])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["commit", "-m", "Change readme", "--no-gpg-sign"])
|
||||
.args(["commit", "-m", "Change readme", "--no-gpg-sign"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["pull", "--rebase"])
|
||||
.args(["pull", "--rebase"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
@@ -1086,7 +1086,7 @@ mod tests {
|
||||
File::create(repo_dir.join("readme.md"))?.sync_all()?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["stash", "--all"])
|
||||
.args(["stash", "--all"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
@@ -1103,7 +1103,7 @@ mod tests {
|
||||
File::create(repo_dir.join("license"))?.sync_all()?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["add", "-A", "-N"])
|
||||
.args(["add", "-A", "-N"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
@@ -1120,7 +1120,7 @@ mod tests {
|
||||
File::create(repo_dir.join("license"))?.sync_all()?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["add", "."])
|
||||
.args(["add", "."])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
@@ -1132,7 +1132,7 @@ mod tests {
|
||||
file.sync_all()?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["add", "."])
|
||||
.args(["add", "."])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
@@ -1144,12 +1144,12 @@ mod tests {
|
||||
|
||||
fn create_renamed(repo_dir: &Path) -> io::Result<()> {
|
||||
create_command("git")?
|
||||
.args(&["mv", "readme.md", "readme.md.bak"])
|
||||
.args(["mv", "readme.md", "readme.md.bak"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["add", "-A"])
|
||||
.args(["add", "-A"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
@@ -1158,12 +1158,12 @@ mod tests {
|
||||
|
||||
fn create_renamed_and_modified(repo_dir: &Path) -> io::Result<()> {
|
||||
create_command("git")?
|
||||
.args(&["mv", "readme.md", "readme.md.bak"])
|
||||
.args(["mv", "readme.md", "readme.md.bak"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["add", "-A"])
|
||||
.args(["add", "-A"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
@@ -1186,7 +1186,7 @@ mod tests {
|
||||
file.sync_all()?;
|
||||
|
||||
create_command("git")?
|
||||
.args(&["add", ".gitignore"])
|
||||
.args(["add", ".gitignore"])
|
||||
.current_dir(repo_dir)
|
||||
.output()?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user