Skip to content

Commit 8de64bd

Browse files
stype: fix clippy::useless_vec warnings rule (#218)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Brooooooklyn <3468483+Brooooooklyn@users.noreply.github.com>
1 parent f090273 commit 8de64bd

File tree

2 files changed

+28
-34
lines changed

2 files changed

+28
-34
lines changed

crates/vite_task/src/config/mod.rs

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ mod tests {
302302

303303
// Test recursive topological build
304304
let task_graph = workspace
305-
.build_task_subgraph(&vec!["build".into()], Arc::default(), true)
305+
.build_task_subgraph(&["build".into()], Arc::default(), true)
306306
.expect("Failed to resolve tasks");
307307

308308
// Verify that all build tasks are included
@@ -359,7 +359,7 @@ mod tests {
359359
.expect("Failed to load workspace");
360360

361361
let task_graph = workspace
362-
.build_task_subgraph(&vec!["@test/web#build".into()], Arc::default(), false)
362+
.build_task_subgraph(&["@test/web#build".into()], Arc::default(), false)
363363
.expect("Failed to resolve tasks");
364364

365365
let has_edge = |from: &str, to: &str| -> bool {
@@ -390,7 +390,7 @@ mod tests {
390390

391391
// Test @test/utils#lint which has explicit dependencies
392392
let task_graph = workspace
393-
.build_task_subgraph(&vec!["@test/utils#lint".into()], Arc::default(), false)
393+
.build_task_subgraph(&["@test/utils#lint".into()], Arc::default(), false)
394394
.expect("Failed to resolve tasks");
395395

396396
let has_edge = |from: &str, to: &str| -> bool {
@@ -431,7 +431,7 @@ mod tests {
431431

432432
// Test @test/utils#lint which has explicit dependencies
433433
let task_graph = workspace
434-
.build_task_subgraph(&vec!["@test/utils#lint".into()], Arc::default(), false)
434+
.build_task_subgraph(&["@test/utils#lint".into()], Arc::default(), false)
435435
.expect("Failed to resolve tasks");
436436

437437
let has_edge = |from: &str, to: &str| -> bool {
@@ -471,7 +471,7 @@ mod tests {
471471

472472
// Test recursive build with topological_run=false
473473
let task_graph = workspace
474-
.build_task_subgraph(&vec!["build".into()], Arc::default(), true)
474+
.build_task_subgraph(&["build".into()], Arc::default(), true)
475475
.expect("Failed to resolve tasks");
476476

477477
// Verify that all build tasks are included (recursive flag works)
@@ -520,7 +520,7 @@ mod tests {
520520
.expect("Failed to load workspace with topological=true");
521521

522522
let graph_true = workspace_true
523-
.build_task_subgraph(&vec!["@test/app#build".into()], Arc::default(), false)
523+
.build_task_subgraph(&["@test/app#build".into()], Arc::default(), false)
524524
.expect("Failed to resolve tasks");
525525

526526
with_unique_cache_path("topological_comparison_false", |cache_path_false| {
@@ -530,7 +530,7 @@ mod tests {
530530
.expect("Failed to load workspace with topological=false");
531531

532532
let graph_false = workspace_false
533-
.build_task_subgraph(&vec!["@test/app#build".into()], Arc::default(), false)
533+
.build_task_subgraph(&["@test/app#build".into()], Arc::default(), false)
534534
.expect("Failed to resolve tasks");
535535

536536
// Count edges in each graph
@@ -579,7 +579,7 @@ mod tests {
579579
// Test recursive build without topological flag
580580
// Note: Even without topological flag, cross-package dependencies are now always included
581581
let task_graph = workspace
582-
.build_task_subgraph(&vec!["build".into()], Arc::default(), true)
582+
.build_task_subgraph(&["build".into()], Arc::default(), true)
583583
.expect("Failed to resolve tasks");
584584

585585
// Verify that all build tasks are included
@@ -617,11 +617,8 @@ mod tests {
617617
.expect("Failed to load workspace");
618618

619619
// Test that specifying a scoped task with recursive flag returns an error
620-
let result = workspace.build_task_subgraph(
621-
&vec!["@test/core#build".into()],
622-
Arc::default(),
623-
true,
624-
);
620+
let result =
621+
workspace.build_task_subgraph(&["@test/core#build".into()], Arc::default(), true);
625622

626623
assert!(result.is_err());
627624
match result {
@@ -643,7 +640,7 @@ mod tests {
643640

644641
// Test non-recursive build of a single package
645642
let task_graph = workspace
646-
.build_task_subgraph(&vec!["@test/utils#build".into()], Arc::default(), false)
643+
.build_task_subgraph(&["@test/utils#build".into()], Arc::default(), false)
647644
.expect("Failed to resolve tasks");
648645

649646
// @test/utils has compound commands (3 subtasks) plus dependencies on @test/core#build
@@ -670,7 +667,7 @@ mod tests {
670667

671668
// Test recursive topological build with compound commands
672669
let task_graph = workspace
673-
.build_task_subgraph(&vec!["build".into()], Arc::default(), true)
670+
.build_task_subgraph(&["build".into()], Arc::default(), true)
674671
.expect("Failed to resolve tasks");
675672

676673
// Check all tasks including subcommands
@@ -726,7 +723,7 @@ mod tests {
726723

727724
// Test recursive topological build with transitive dependencies
728725
let task_graph = workspace
729-
.build_task_subgraph(&vec!["build".into()], Arc::default(), true)
726+
.build_task_subgraph(&["build".into()], Arc::default(), true)
730727
.expect("Failed to resolve tasks");
731728

732729
// Verify that all build tasks are included
@@ -770,7 +767,7 @@ mod tests {
770767

771768
// Test build task graph
772769
let build_graph = workspace
773-
.build_task_subgraph(&vec!["build".into()], Arc::default(), true)
770+
.build_task_subgraph(&["build".into()], Arc::default(), true)
774771
.expect("Failed to resolve build tasks");
775772

776773
let build_tasks: Vec<_> =
@@ -849,7 +846,7 @@ mod tests {
849846

850847
// Test test task graph
851848
let test_graph = workspace
852-
.build_task_subgraph(&vec!["test".into()], Arc::default(), true)
849+
.build_task_subgraph(&["test".into()], Arc::default(), true)
853850
.expect("Failed to resolve test tasks");
854851

855852
let test_tasks: Vec<_> =
@@ -873,7 +870,7 @@ mod tests {
873870

874871
// Test specific package task
875872
let api_build_graph = workspace
876-
.build_task_subgraph(&vec!["@test/api#build".into()], Arc::default(), false)
873+
.build_task_subgraph(&["@test/api#build".into()], Arc::default(), false)
877874
.expect("Failed to resolve api build task");
878875

879876
let api_deps: Vec<_> =
@@ -898,11 +895,8 @@ mod tests {
898895
.expect("Failed to load workspace");
899896

900897
// Test that we can't use recursive with task names containing # (would be interpreted as scope)
901-
let result = workspace.build_task_subgraph(
902-
&vec!["test#integration".into()],
903-
Arc::default(),
904-
true,
905-
);
898+
let result =
899+
workspace.build_task_subgraph(&["test#integration".into()], Arc::default(), true);
906900
assert!(result.is_err(), "Recursive run with # in task name should fail");
907901
})
908902
}
@@ -917,7 +911,7 @@ mod tests {
917911

918912
// Test app build task graph - this should show the full dependency tree
919913
let app_build_graph = workspace
920-
.build_task_subgraph(&vec!["@test/app#build".into()], Arc::default(), false)
914+
.build_task_subgraph(&["@test/app#build".into()], Arc::default(), false)
921915
.expect("Failed to resolve app build task");
922916

923917
// Expected task graph structure:
@@ -1164,7 +1158,7 @@ mod tests {
11641158

11651159
// Test resolving build task recursively - should find both packages
11661160
let build_tasks = workspace
1167-
.build_task_subgraph(&vec!["build".into()], Arc::default(), true)
1161+
.build_task_subgraph(&["build".into()], Arc::default(), true)
11681162
.expect("Failed to resolve build tasks recursively");
11691163

11701164
let task_names: Vec<_> =
@@ -1182,7 +1176,7 @@ mod tests {
11821176

11831177
// Test that empty-name package internal dependencies work
11841178
let empty_build = workspace
1185-
.build_task_subgraph(&vec!["#build".into()], Arc::default(), false)
1179+
.build_task_subgraph(&["#build".into()], Arc::default(), false)
11861180
.expect("Failed to resolve empty-name build");
11871181

11881182
let empty_build_tasks: Vec<_> =
@@ -1231,7 +1225,7 @@ mod tests {
12311225

12321226
// Test recursive build includes both nameless packages
12331227
let build_tasks = workspace
1234-
.build_task_subgraph(&vec!["build".into()], Arc::default(), true)
1228+
.build_task_subgraph(&["build".into()], Arc::default(), true)
12351229
.expect("Failed to resolve build tasks recursively");
12361230

12371231
let task_names: Vec<_> =
@@ -1255,7 +1249,7 @@ mod tests {
12551249
// Test that nameless packages can have different internal dependencies
12561250
// The second nameless package has more complex dependencies
12571251
let deploy_tasks = workspace
1258-
.build_task_subgraph(&vec!["deploy".into()], Arc::default(), true)
1252+
.build_task_subgraph(&["deploy".into()], Arc::default(), true)
12591253
.expect("Failed to resolve deploy tasks");
12601254

12611255
let deploy_task_names: Vec<_> =
@@ -1277,7 +1271,7 @@ mod tests {
12771271

12781272
// Verify that dependencies between nameless packages don't interfere
12791273
let test_tasks = workspace
1280-
.build_task_subgraph(&vec!["test".into()], Arc::default(), true)
1274+
.build_task_subgraph(&["test".into()], Arc::default(), true)
12811275
.expect("Failed to resolve test tasks");
12821276

12831277
let test_task_names: Vec<_> =
@@ -1292,7 +1286,7 @@ mod tests {
12921286
// The second nameless package depends on normal-package
12931287
// With topological ordering, build tasks should respect package dependencies
12941288
let build_graph = workspace
1295-
.build_task_subgraph(&vec!["build".into()], Arc::default(), true)
1289+
.build_task_subgraph(&["build".into()], Arc::default(), true)
12961290
.expect("Failed to resolve build with topological");
12971291

12981292
// Helper to check edges
@@ -1337,7 +1331,7 @@ mod tests {
13371331

13381332
// First, test that the original scoped task works
13391333
let api_build_scoped = workspace
1340-
.build_task_subgraph(&vec!["@test/api#build".into()], Arc::default(), false)
1334+
.build_task_subgraph(&["@test/api#build".into()], Arc::default(), false)
13411335
.expect("Failed to resolve @test/api#build");
13421336

13431337
// Find the number of tasks for API build
@@ -1346,7 +1340,7 @@ mod tests {
13461340

13471341
// Test that we can resolve task with '#' in package
13481342
let app_test_scoped = workspace
1349-
.build_task_subgraph(&vec!["@test/app#test".into()], Arc::default(), false)
1343+
.build_task_subgraph(&["@test/app#test".into()], Arc::default(), false)
13501344
.expect("Failed to resolve @test/app#test");
13511345

13521346
// Should include dependencies

crates/vite_task/src/schedule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ mod tests {
275275

276276
// Test build task graph
277277
let build_graph = workspace
278-
.build_task_subgraph(&vec!["build".into()], Arc::default(), true)
278+
.build_task_subgraph(&["build".into()], Arc::default(), true)
279279
.expect("Failed to resolve build tasks");
280280

281281
let plan =

0 commit comments

Comments
 (0)