Skip to content

Commit 57f41e1

Browse files
committed
Use more flexible slices instead of &Vec<&str>
1 parent fb21914 commit 57f41e1

File tree

13 files changed

+39
-38
lines changed

13 files changed

+39
-38
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/tracel-xtask/src/commands/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub(crate) fn run_build(
3232
group!("Build Workspace");
3333
run_process_for_workspace(
3434
"cargo",
35-
vec!["build", "--workspace", "--color", "always"],
35+
&["build", "--workspace", "--color", "always"],
3636
excluded,
3737
None,
3838
None,
@@ -54,7 +54,7 @@ pub(crate) fn run_build(
5454
run_process_for_package(
5555
"cargo",
5656
&member.name,
57-
&vec!["build", "-p", &member.name, "--color", "always"],
57+
&["build", "-p", &member.name, "--color", "always"],
5858
excluded,
5959
only,
6060
&format!("Build command failed for {}", &member.name),

crates/tracel-xtask/src/commands/bump.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn bump(command: &BumpSubCommand) -> anyhow::Result<()> {
1717
ensure_cargo_crate_is_installed("cargo-edit", None, None, false)?;
1818
run_process(
1919
"cargo",
20-
&vec!["set-version", "--bump", &command.to_string()],
20+
&["set-version", "--bump", &command.to_string()],
2121
None,
2222
None,
2323
&format!("Error trying to bump {command} version"),

crates/tracel-xtask/src/commands/check.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn run_audit() -> anyhow::Result<()> {
5252
ensure_cargo_crate_is_installed("cargo-audit", Some("fix"), None, false)?;
5353
run_process(
5454
"cargo",
55-
&vec!["audit", "-q", "--color", "always"],
55+
&["audit", "-q", "--color", "always"],
5656
None,
5757
None,
5858
"Audit check execution failed",
@@ -67,7 +67,7 @@ fn run_format(target: &Target, excluded: &[String], only: &[String]) -> anyhow::
6767
group!("Format Workspace");
6868
run_process_for_workspace(
6969
"cargo",
70-
vec!["fmt", "--check"],
70+
&["fmt", "--check"],
7171
&[],
7272
None,
7373
None,
@@ -89,7 +89,7 @@ fn run_format(target: &Target, excluded: &[String], only: &[String]) -> anyhow::
8989
run_process_for_package(
9090
"cargo",
9191
&member.name,
92-
&vec!["fmt", "--check", "-p", &member.name],
92+
&["fmt", "--check", "-p", &member.name],
9393
excluded,
9494
only,
9595
&format!("Format check execution failed for {}", &member.name),
@@ -114,7 +114,7 @@ fn run_lint(target: &Target, excluded: &[String], only: &[String]) -> anyhow::Re
114114
group!("Lint Workspace");
115115
run_process_for_workspace(
116116
"cargo",
117-
vec![
117+
&[
118118
"clippy",
119119
"--no-deps",
120120
"--color=always",
@@ -143,7 +143,7 @@ fn run_lint(target: &Target, excluded: &[String], only: &[String]) -> anyhow::Re
143143
run_process_for_package(
144144
"cargo",
145145
&member.name,
146-
&vec![
146+
&[
147147
"clippy",
148148
"--no-deps",
149149
"--color=always",
@@ -178,7 +178,7 @@ fn run_typos() -> anyhow::Result<()> {
178178
group!("Typos");
179179
run_process(
180180
"typos",
181-
&vec!["--diff", "--color", "always"],
181+
&["--diff", "--color", "always"],
182182
None,
183183
None,
184184
"Typos check execution failed",

crates/tracel-xtask/src/commands/compile.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub(crate) fn run_compile(
3232
group!("Compile Workspace");
3333
run_process_for_workspace(
3434
"cargo",
35-
vec!["check", "--workspace"],
35+
&["check", "--workspace"],
3636
excluded,
3737
None,
3838
None,
@@ -54,7 +54,7 @@ pub(crate) fn run_compile(
5454
run_process_for_package(
5555
"cargo",
5656
&member.name,
57-
&vec!["check", "-p", &member.name],
57+
&["check", "-p", &member.name],
5858
excluded,
5959
only,
6060
&format!("Compilation failed for {}", &member.name),

crates/tracel-xtask/src/commands/dependencies.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn run_cargo_deny() -> anyhow::Result<()> {
2626
group!("Cargo: run deny checks");
2727
run_process(
2828
"cargo",
29-
&vec!["deny", "check"],
29+
&["deny", "check"],
3030
None,
3131
None,
3232
"Some dependencies don't meet the requirements!",
@@ -42,7 +42,7 @@ fn run_cargo_machete() -> anyhow::Result<()> {
4242
group!("Cargo: run unused dependencies checks");
4343
run_process(
4444
"cargo",
45-
&vec!["machete"],
45+
&["machete"],
4646
None,
4747
None,
4848
"Unused dependencies found!",

crates/tracel-xtask/src/commands/doc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn run_documentation_build(
3535
group!("Build Workspace documentation");
3636
run_process_for_workspace(
3737
"cargo",
38-
vec!["doc", "--workspace", "--no-deps", "--color=always"],
38+
&["doc", "--workspace", "--no-deps", "--color=always"],
3939
excluded,
4040
None,
4141
None,
@@ -57,7 +57,7 @@ fn run_documentation_build(
5757
run_process_for_package(
5858
"cargo",
5959
&member.name,
60-
&vec!["doc", "-p", &member.name, "--no-deps", "--color=always"],
60+
&["doc", "-p", &member.name, "--no-deps", "--color=always"],
6161
excluded,
6262
only,
6363
&format!("Format check execution failed for {}", &member.name),
@@ -86,7 +86,7 @@ pub(crate) fn run_documentation(
8686
group!("Workspace Documentation Tests");
8787
run_process_for_workspace(
8888
"cargo",
89-
vec!["test", "--workspace", "--doc", "--color", "always"],
89+
&["test", "--workspace", "--doc", "--color", "always"],
9090
excluded,
9191
Some(r"Doc-tests (\w+)"),
9292
Some("Doc Tests"),
@@ -125,7 +125,7 @@ fn run_doc_test(
125125
run_process_for_package(
126126
"cargo",
127127
&member.name,
128-
&vec!["test", "--doc", "-p", &member.name],
128+
&["test", "--doc", "-p", &member.name],
129129
excluded,
130130
only,
131131
&format!(

crates/tracel-xtask/src/commands/fix.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub(crate) fn run_audit() -> anyhow::Result<()> {
5757
group!("Audit Rust Dependencies");
5858
run_process(
5959
"cargo",
60-
&vec!["audit", "-q", "--color", "always", "fix"],
60+
&["audit", "-q", "--color", "always", "fix"],
6161
None,
6262
None,
6363
"Audit check execution failed",
@@ -72,7 +72,7 @@ fn run_format(target: &Target, excluded: &Vec<String>, only: &Vec<String>) -> Re
7272
group!("Format Workspace");
7373
run_process_for_workspace(
7474
"cargo",
75-
vec!["fmt"],
75+
&["fmt"],
7676
&[],
7777
None,
7878
None,
@@ -93,7 +93,7 @@ fn run_format(target: &Target, excluded: &Vec<String>, only: &Vec<String>) -> Re
9393
run_process_for_package(
9494
"cargo",
9595
&member.name,
96-
&vec!["fmt", "-p", &member.name],
96+
&["fmt", "-p", &member.name],
9797
excluded,
9898
only,
9999
&format!("Format check execution failed for {}", &member.name),
@@ -118,7 +118,7 @@ fn run_lint(target: &Target, excluded: &Vec<String>, only: &Vec<String>) -> anyh
118118
group!("Lint Workspace");
119119
run_process_for_workspace(
120120
"cargo",
121-
vec![
121+
&[
122122
"clippy",
123123
"--no-deps",
124124
"--fix",
@@ -149,7 +149,7 @@ fn run_lint(target: &Target, excluded: &Vec<String>, only: &Vec<String>) -> anyh
149149
run_process_for_package(
150150
"cargo",
151151
&member.name,
152-
&vec![
152+
&[
153153
"clippy",
154154
"--no-deps",
155155
"--fix",
@@ -185,7 +185,7 @@ pub(crate) fn run_typos() -> anyhow::Result<()> {
185185
group!("Typos");
186186
run_process(
187187
"typos",
188-
&vec!["--write-changes", "--color", "always"],
188+
&["--write-changes", "--color", "always"],
189189
None,
190190
None,
191191
"Some typos have been found and cannot be fixed.",

crates/tracel-xtask/src/commands/publish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn publish(crate_name: String) -> anyhow::Result<()> {
8686
// Perform dry-run to ensure everything is good for publishing
8787
run_process(
8888
"cargo",
89-
&vec!["publish", "-p", &crate_name, "--dry-run"],
89+
&["publish", "-p", &crate_name, "--dry-run"],
9090
None,
9191
None,
9292
&format!("Publish dry run failed for crate '{}'.", &crate_name),

crates/tracel-xtask/src/commands/test.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ pub fn run_unit(target: &Target, args: &TestCmdArgs) -> Result<()> {
6666
.map(|s| s.to_string())
6767
.collect::<Vec<String>>();
6868
push_optional_args(&mut cmd_args, args);
69+
// let cmd_args: Vec<&str> = cmd_args.iter().map(String::as_str).collect();
6970
run_process_for_workspace(
7071
"cargo",
71-
cmd_args.iter().map(String::as_str).collect(),
72+
&cmd_args.iter().map(String::as_str).collect::<Vec<&str>>(),
7273
&args.exclude,
7374
Some(r".*target/[^/]+/deps/([^-\s]+)"),
7475
Some("Unit Tests"),
@@ -115,7 +116,7 @@ fn run_unit_test(member: &WorkspaceMember, args: &TestCmdArgs) -> Result<(), any
115116
run_process_for_package(
116117
"cargo",
117118
&member.name,
118-
&cmd_args.iter().map(String::as_str).collect(),
119+
&cmd_args.iter().map(String::as_str).collect::<Vec<&str>>(),
119120
&args.exclude,
120121
&args.only,
121122
&format!("Failed to execute unit test for '{}'", &member.name),
@@ -140,7 +141,7 @@ pub fn run_integration(target: &Target, args: &TestCmdArgs) -> anyhow::Result<()
140141
push_optional_args(&mut cmd_args, args);
141142
run_process_for_workspace(
142143
"cargo",
143-
cmd_args.iter().map(String::as_str).collect(),
144+
&cmd_args.iter().map(String::as_str).collect::<Vec<&str>>(),
144145
&args.exclude,
145146
Some(r".*target/[^/]+/deps/([^-\s]+)"),
146147
Some("Integration Tests"),
@@ -187,7 +188,7 @@ fn run_integration_test(member: &WorkspaceMember, args: &TestCmdArgs) -> Result<
187188
run_process_for_package(
188189
"cargo",
189190
&member.name,
190-
&cmd_args.iter().map(String::as_str).collect(),
191+
&cmd_args.iter().map(String::as_str).collect::<Vec<&str>>(),
191192
&args.exclude,
192193
&args.only,
193194
&format!("Failed to execute integration test for '{}'", &member.name),

0 commit comments

Comments
 (0)