Skip to content

Fix clippy errors#1412

Merged
tsmbland merged 1 commit into
update_rust_toolchain_actionfrom
fix_clippy_errors
Jul 13, 2026
Merged

Fix clippy errors#1412
tsmbland merged 1 commit into
update_rust_toolchain_actionfrom
fix_clippy_errors

Conversation

@tsmbland

@tsmbland tsmbland commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Description

There are a few clippy errors after updating the rust toolchain in #1410. Each had a suggested change, so I've just gone through and done what it's suggested. Specifically:

  • removing some unnecessary &s
  • using the assert_eq! and assert_ne! macros

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change to fix an issue)
  • New feature (non-breaking change to add functionality)
  • Refactoring (non-breaking, non-functional change to improve maintainability)
  • Optimization (non-breaking change to speed up the code)
  • Breaking change (whatever its nature)
  • Documentation (improve or add documentation)

Key checklist

  • All tests pass: $ cargo test
  • The documentation builds and looks OK: $ cargo doc
  • Update release notes for the latest release if this PR adds a new feature or fixes a bug
    present in the previous release

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@tsmbland tsmbland marked this pull request as ready for review July 13, 2026 09:58
@tsmbland tsmbland requested review from Copilot, dalonsoa and dc2917 July 13, 2026 09:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 addresses clippy warnings introduced after the Rust toolchain update in #1410 by applying clippy’s suggested refactors, primarily around unnecessary borrows and clearer assertion macros.

Changes:

  • Replaced boolean assert!(a == b) / assert!(a != b) patterns with assert_eq! / assert_ne! in tests.
  • Removed needless & borrows in logging/formatting and error-context messages.

Reviewed changes

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

Show a summary per file
File Description
tests/regression.rs Uses assert_eq! for clearer output-directory comparison assertions.
src/simulation/market.rs Removes needless borrow in debug logging for agent ID.
src/simulation/investment/appraisal.rs Uses assert_eq! for clearer commission year test assertions.
src/simulation/investment.rs Removes needless borrows in ensure!/warn!/debug! formatting and debug-info string formatting.
src/process.rs Uses assert_eq! for clearer FlowDirection test assertions.
src/input/process/availability.rs Removes needless borrow in parse-range context error message formatting.
src/input/agent/search_space.rs Removes needless borrow when formatting process ID in validation error.
src/asset/capacity.rs Uses assert_ne! in partial-cmp test for clearer failures.
src/asset.rs Removes needless borrows in context error message formatting for missing process inputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.44%. Comparing base (b5b2150) to head (6b8aa1b).

Files with missing lines Patch % Lines
src/asset.rs 0.00% 3 Missing ⚠️
src/simulation/investment.rs 33.33% 2 Missing ⚠️
src/input/process/availability.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                       Coverage Diff                        @@
##           update_rust_toolchain_action    #1412      +/-   ##
================================================================
+ Coverage                         89.42%   89.44%   +0.02%     
================================================================
  Files                                59       59              
  Lines                              8367     8364       -3     
  Branches                           8367     8364       -3     
================================================================
- Hits                               7482     7481       -1     
+ Misses                              564      562       -2     
  Partials                            321      321              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dc2917 dc2917 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

removing some unnecessary &s

Interesting that . does the pointer de-referencing for you, and maybe slightly concerning that it was letting you de-reference anyway? But I guess this at least means you don't get the ugly syntax for accessing fields of structs from their pointers like in C & C++.

@tsmbland

Copy link
Copy Markdown
Collaborator Author

removing some unnecessary &s

Interesting that . does the pointer de-referencing for you, and maybe slightly concerning that it was letting you de-reference anyway? But I guess this at least means you don't get the ugly syntax for accessing fields of structs from their pointers like in C & C++.

True! I think the fact that I've managed to code in rust for 2 years without consciously realising that . de-refs for you is probably a good endorsement of the feature 😂

@tsmbland tsmbland merged commit 4d619e9 into update_rust_toolchain_action Jul 13, 2026
8 of 9 checks passed
@tsmbland tsmbland deleted the fix_clippy_errors branch July 13, 2026 12:24
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.

3 participants