Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 3, 2025

This PR resolves all clippy warnings when running cargo clippy --workspace --all-targets -- -D warnings and formats the codebase using cargo fmt.

Issues Fixed

Non-local Implementation Definitions

Moved impl Environment for TestEnvironment blocks outside of functions in test files to comply with Rust's scoping rules:

  • crates/pet-poetry/tests/common.rs
  • crates/pet-pyenv/tests/common.rs
  • crates/pet-conda/tests/common.rs

Pointer Argument Optimizations

Replaced &String parameters with &str for better performance and idiomatic Rust:

  • crates/pet/tests/common.rs: Functions does_version_match, get_version, is_valid_version
  • crates/pet-conda/tests/ci_test.rs: Function get_version

Field Assignment Improvements

Replaced field assignments on Default::default() with struct initialization syntax:

  • crates/pet/tests/ci_test.rs: Configuration objects (2 instances)
  • crates/pet/tests/ci_poetry.rs: Configuration objects (2 instances)

Code Deduplication

Combined identical conditional blocks that had the same behavior for known issues:

Unnecessary Code Removal

  • Removed needless ..Default::default() syntax where all struct fields were explicitly specified in crates/pet-pyenv/tests/pyenv_test.rs
  • Removed unnecessary return statement in crates/pet/tests/ci_test.rs
  • Fixed empty line after outer attribute in crates/pet-poetry/tests/config_test.rs

Configuration Fix

Added missing ci feature to crates/pet-poetry/Cargo.toml to resolve unexpected cfg condition warnings for CI-related conditional compilation.

Verification

All changes maintain existing functionality while improving code quality and performance. The build now passes cleanly with:

cargo clippy --workspace --all-targets -- -D warnings

Code has been formatted consistently across the workspace using cargo fmt --all.

Created from VS Code via the GitHub Pull Request extension.


💡 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.

Copilot AI and others added 2 commits September 3, 2025 02:46
Co-authored-by: karthiknadig <3840081+karthiknadig@users.noreply.github.com>
Co-authored-by: karthiknadig <3840081+karthiknadig@users.noreply.github.com>
Copilot AI changed the title [WIP] Running cargo clippy --workspace --all-targets -- -D warnings seems to raise a lot of errors. Can you fix them? also run cargo fmt after you have fixed everything. Fix all clippy warnings and format code with cargo fmt Sep 3, 2025
Copilot AI requested a review from karthiknadig September 3, 2025 02:55
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.

2 participants