Fix clippy errors#1412
Conversation
There was a problem hiding this comment.
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 withassert_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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
dc2917
left a comment
There was a problem hiding this comment.
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 |
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:
&sassert_eq!andassert_ne!macrosFixes # (issue)
Type of change
Key checklist
$ cargo test$ cargo docpresent in the previous release
Further checks