-
Notifications
You must be signed in to change notification settings - Fork 10
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
refact: use cfg_if to control feature related code #361
refact: use cfg_if to control feature related code #361
Conversation
Signed-off-by: Kilerd Chan <blove694@gmail.com>
WalkthroughThe recent changes to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Ledger
participant Plugin
participant Timezone
User->>Ledger: Request plugin execution
Ledger->>Ledger: Check plugins feature
alt Plugins enabled
Ledger->>Ledger: Check plugin_runtime feature
alt Plugin runtime enabled
Ledger->>Plugin: Execute registered plugins
Plugin->>Ledger: Return processed directives
else Plugin runtime not enabled
Ledger->>User: Return unprocessed directives
end
else Plugins not enabled
Ledger->>User: Return unprocessed directives
end
sequenceDiagram
participant User
participant Timezone
User->>Timezone: Request timezone detection
alt iana-time-zone feature enabled
Timezone->>Timezone: Retrieve system timezone
Timezone->>User: Return timezone or warning
else iana-time-zone feature not enabled
Timezone->>User: Return default timezone
end
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
@coderabbitai review |
Actions performedReview triggered.
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
Files selected for processing (3)
- zhang-core/Cargo.toml (1 hunks)
- zhang-core/src/ledger.rs (3 hunks)
- zhang-core/src/options.rs (2 hunks)
Additional comments not posted (5)
zhang-core/Cargo.toml (1)
43-43
: Dependency Addition:cfg-if
The addition of the
cfg-if
dependency is appropriate for managing conditional compilation more effectively. Ensure that this dependency is necessary and utilized in the codebase.zhang-core/src/options.rs (2)
5-5
: Dependency Import:cfg_if
The import of
cfg_if
is necessary for the refactoring performed in this file.
43-60
: Refactor: Usecfg_if
for Conditional CompilationThe use of
cfg_if
macro improves the readability and maintainability of thedetect_timezone
function by consolidating conditional compilation logic into a single structure. This change does not alter the functionality but enhances code clarity.zhang-core/src/ledger.rs (2)
8-8
: Dependency Import:cfg_if
The import of
cfg_if
is necessary for the refactoring performed in this file.
Line range hint
328-353
:
Refactor: Usecfg_if
for Conditional CompilationThe use of
cfg_if
macro improves the readability and maintainability of thehandle_plugin_execution
method by consolidating conditional compilation logic into a single structure. This change does not alter the functionality but enhances code clarity.
Summary by CodeRabbit
New Features
Improvements