stype: fix clippy::useless_vec warnings rule#218
Conversation
Co-authored-by: Brooooooklyn <3468483+Brooooooklyn@users.noreply.github.com>
|
@copilot cargo fmt error |
|
@copilot update yarn.lock |
Co-authored-by: Brooooooklyn <3468483+Brooooooklyn@users.noreply.github.com>
Fixed the cargo fmt formatting issues in commit e2c8e71. |
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? |
There was a problem hiding this comment.
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.
Merge activity
|
Fix clippy::useless_vec warnings by replacing
vec![...]with array slices&[...]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
💡 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.