Skip to content

Conversation

@kunsonx
Copy link
Contributor

@kunsonx kunsonx commented Apr 29, 2025

Project code style now are fixed by clippy.

@kunsonx kunsonx requested a review from Copilot April 29, 2025 13:30
Copy link

Copilot AI left a 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.

Comment on lines 513 to 515
self.slippage_tolerance?;

let slippage = self.slippage_tolerance.unwrap();
Copy link

Copilot AI Apr 29, 2025

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.

Suggested change
self.slippage_tolerance?;
let slippage = self.slippage_tolerance.unwrap();
let slippage = self.slippage_tolerance?;

Copilot uses AI. Check for mistakes.
@kunsonx kunsonx requested a review from Copilot April 29, 2025 13:34
Copy link

Copilot AI left a 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() }),

@kunsonx kunsonx merged commit 9b0300d into main Apr 29, 2025
2 checks passed
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