-
Notifications
You must be signed in to change notification settings - Fork 4
chore: clippy style fix #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
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 applies Clippy-driven style fixes across the project. Key changes include:
- Updating loop variable names and converting unused iterators to underscore-prefixed variables.
- Refactoring struct initializations from step-by-step mutations to record-style constructions.
- Changing function parameters from Vec references to slice references and simplifying control flow in comparison/exchange chains.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| apex-core/tests/stress.rs | Renamed the loop variable to indicate it is unused. |
| apex-core/tests/common.rs | Converted order construction to a more concise record initialization. |
| apex-core/src/engine/types.rs | Refactored clone implementation and streamlined state updates. |
| apex-core/src/engine/syncer.rs | Updated function signatures to take slice references instead of Vec. |
| apex-core/src/engine/matching.rs | Simplified returning from closures in the matching engine logic. |
| apex-core/src/engine/book.rs | Updated sync methods to use slice references and simplified options. |
| apex-core/src/engine.rs | Reorganized module re-exports in the prelude. |
| apex-core/benches/common.rs | Applied similar stylistic refactoring as in tests. |
| .github/workflows/ci.yml | Enhanced CI configuration to run Clippy and to include dev-* branches. |
apex-core/src/engine/types.rs
Outdated
| self.slippage_tolerance?; | ||
|
|
||
| let slippage = self.slippage_tolerance.unwrap(); |
Copilot
AI
Apr 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider capturing the unwrapped value of 'slippage_tolerance' into a variable (e.g., 'let slippage = self.slippage_tolerance?;') so that you can avoid calling unwrap() immediately afterward. This reduces redundant lookups and enhances clarity.
| self.slippage_tolerance?; | |
| let slippage = self.slippage_tolerance.unwrap(); | |
| let slippage = self.slippage_tolerance?; |
There was a problem hiding this comment.
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 applies clippy-driven style fixes and code cleanup across the project. Key changes include updating loop variable names, refactoring struct initializations, simplifying error-handling patterns, and updating type signatures for consistency.
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 |
|---|---|
| apex-core/tests/stress.rs | Changed unused loop variable for clarity |
| apex-core/tests/common.rs | Refactored order creation with struct initializer syntax |
| apex-core/src/engine/types.rs | Streamlined atomic and lifecycle handling and use of shorthand patterns |
| apex-core/src/engine/syncer.rs | Updated function parameter types to slice types |
| apex-core/src/engine/matching.rs | Removed explicit return statement in favor of expression style |
| apex-core/src/engine/book.rs | Simplified option mapping and function parameter types |
| apex-core/src/engine.rs | Adjusted module re-exports accordingly |
| apex-core/benches/common.rs | Applied similar refactoring as in tests/common.rs |
| .github/workflows/ci.yml | Updated CI pipeline configuration to include clippy checks |
Comments suppressed due to low confidence (2)
apex-core/src/engine/types.rs:344
- Ensure that CancelReason implements Copy since the clone() call has been removed; if it is not Copy, this change might lead to unintended behavior.
cancel_reason: UnsafeCell::new(unsafe { *self.cancel_reason.get() }),
apex-core/src/engine/types.rs:345
- Ensure that RejectReason implements Copy since the clone() call has been removed; if it is not Copy, this change might cause issues.
reject_reason: UnsafeCell::new(unsafe { *self.reject_reason.get() }),
Project code style now are fixed by clippy.