Skip to content

stype: fix clippy::useless_vec warnings rule#218

Merged
Brooooooklyn merged 3 commits intomainfrom
copilot/fix-useless-vec-warning
Oct 13, 2025
Merged

stype: fix clippy::useless_vec warnings rule#218
Brooooooklyn merged 3 commits intomainfrom
copilot/fix-useless-vec-warning

Conversation

Copy link
Copy Markdown

Copilot AI commented Oct 11, 2025

Fix clippy::useless_vec warnings by replacing vec![...] with array slices &[...]

  • Identify all useless_vec warnings in the codebase
  • Fix warnings in crates/vite_task/src/config/mod.rs (24 instances in tests)
  • Fix warning in crates/vite_task/src/schedule.rs (1 instance in tests)
  • Run clippy to verify all warnings are fixed
  • Run tests to ensure no regression
  • Fix cargo fmt formatting issues

All 25 instances of vec![...] with single elements have been replaced with array slices &[...] in test code. Tests pass successfully, clippy no longer reports useless_vec warnings, and cargo fmt passes.

Original prompt

Fix clippy::useless_vec clippy warning


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Brooooooklyn <3468483+Brooooooklyn@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix clippy::useless_vec warning Fix clippy::useless_vec warnings in test code Oct 11, 2025
Copilot AI requested a review from Brooooooklyn October 11, 2025 02:21
@Brooooooklyn
Copy link
Copy Markdown
Member

@copilot cargo fmt error

@Brooooooklyn
Copy link
Copy Markdown
Member

@copilot update yarn.lock

Co-authored-by: Brooooooklyn <3468483+Brooooooklyn@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Oct 11, 2025

@copilot cargo fmt error

Fixed the cargo fmt formatting issues in commit e2c8e71.

Copy link
Copy Markdown
Author

Copilot AI commented Oct 11, 2025

@copilot update yarn.lock

There's no yarn.lock file in this repository - it uses pnpm (pnpm-lock.yaml). My changes only modified Rust test code and didn't add or update any dependencies. Could you clarify what needs to be updated?

@Brooooooklyn Brooooooklyn marked this pull request as ready for review October 11, 2025 06:41
Copilot AI review requested due to automatic review settings October 11, 2025 06:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes clippy::useless_vec warnings by replacing vec![...] with array slices &[...] in test code across the vite_task crate. The changes improve code efficiency by eliminating unnecessary heap allocations when passing single-element collections as function arguments.

  • Replaced 25 instances of vec![single_element] with &[single_element] in test methods
  • Updated function calls to use array slice references instead of vectors
  • Maintained all test functionality while improving performance

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/vite_task/src/schedule.rs Fixed one useless_vec warning in build_task_subgraph call
crates/vite_task/src/config/mod.rs Fixed 24 useless_vec warnings across multiple test functions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Copy Markdown
Member

Brooooooklyn commented Oct 13, 2025

Merge activity

  • Oct 13, 2:56 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 13, 3:00 AM UTC: Graphite couldn't merge this PR because it failed for an unknown reason.
  • Oct 13, 4:23 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 13, 4:24 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 13, 4:28 AM UTC: Graphite couldn't merge this PR because it failed for an unknown reason.

@Brooooooklyn Brooooooklyn changed the title Fix clippy::useless_vec warnings in test code stype: fix clippy::useless_vec warnings rule Oct 13, 2025
@Brooooooklyn Brooooooklyn merged commit 8de64bd into main Oct 13, 2025
9 checks passed
@Brooooooklyn Brooooooklyn deleted the copilot/fix-useless-vec-warning branch October 13, 2025 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants