Skip to content

Commit 3dd881b

Browse files
committed
fix(clippy): satisfy new lints from nightly-2026-03-15
- collapsible_match: fold the bounds check into the KeyCode::Down match arm guard in vite_install package_manager - unnecessary_sort_by: switch descending sorts in vite_js_runtime and vite_setup to sort_by_key with std::cmp::Reverse - unnecessary_trailing_comma: drop trailing comma in a help.rs test assertion
1 parent c9531ce commit 3dd881b

4 files changed

Lines changed: 5 additions & 7 deletions

File tree

crates/vite_install/src/package_manager.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -871,10 +871,8 @@ fn interactive_package_manager_menu() -> Result<PackageManagerType, Error> {
871871
KeyCode::Up => {
872872
selected_index = selected_index.saturating_sub(1);
873873
}
874-
KeyCode::Down => {
875-
if selected_index < options.len() - 1 {
876-
selected_index += 1;
877-
}
874+
KeyCode::Down if selected_index < options.len() - 1 => {
875+
selected_index += 1;
878876
}
879877
KeyCode::Enter | KeyCode::Char(' ') => {
880878
break Ok(options[selected_index].1);

crates/vite_js_runtime/src/providers/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ impl NodeProvider {
437437
}
438438

439439
// Sort by major version descending (highest first)
440-
lts_lines.sort_by(|a, b| b.1.cmp(&a.1));
440+
lts_lines.sort_by_key(|b| std::cmp::Reverse(b.1));
441441

442442
// offset is negative, so lts/-1 = index 1 (second highest)
443443
let index = (-offset) as usize;

crates/vite_setup/src/install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ pub async fn cleanup_old_versions(
475475
}
476476

477477
// Sort newest first (by creation time, matching install.sh)
478-
versions.sort_by(|a, b| b.0.cmp(&a.0));
478+
versions.sort_by_key(|b| std::cmp::Reverse(b.0));
479479

480480
// Remove versions beyond the keep limit, but never remove protected versions
481481
for (_time, path) in versions.into_iter().skip(max_keep) {

packages/cli/binding/src/cli/help.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ mod tests {
225225
// accepted as task arguments instead of producing a parse error.
226226
let args = CLIArgs::try_parse_from(["vp", "run", "--yolo"]).unwrap();
227227
let debug = vite_str::format!("{args:?}");
228-
assert!(debug.contains("\"--yolo\""), "Expected --yolo in task args, got: {debug}",);
228+
assert!(debug.contains("\"--yolo\""), "Expected --yolo in task args, got: {debug}");
229229
assert!(matches!(args, CLIArgs::ViteTask(Command::Run(_))));
230230
}
231231

0 commit comments

Comments
 (0)