Skip to content

refactor: Simplify derive macro implementation - #16

Merged
0xvasanth merged 2 commits into
mainfrom
refactor/simplify-derive-macro-implementation
Oct 18, 2025
Merged

refactor: Simplify derive macro implementation#16
0xvasanth merged 2 commits into
mainfrom
refactor/simplify-derive-macro-implementation

Conversation

@0xvasanth

Copy link
Copy Markdown
Owner

Summary

  • Simplify Gonfig derive macro code generation
  • Fix remaining clippy warnings in core library files

Changes

Code Simplification

  • Extract shared logic: Created reusable setup_env_cli code block to eliminate duplication between from_gonfig_with_builder() and gonfig_builder() methods
  • Simplify config file loading: Replaced verbose if-else chain with clean loop over config file types
  • Clean up variable usage: Removed unused allow_env variable
  • Streamline environment key generation: Simplified logic with cleaner pattern matching
  • Remove redundant comments: Cleaned up unnecessary code comments

Code Quality

  • Fixed clippy::uninlined_format_args warnings in core library:
    • src/builder.rs
    • src/cli.rs
    • src/config.rs

Benefits

  1. Reduced code duplication: Shared environment/CLI setup logic now in one place
  2. Better maintainability: Future changes only need to be made once
  3. Improved readability: Cleaner, more concise code flow
  4. Consistent style: All format strings follow modern Rust conventions

Test plan

  • All existing tests pass
  • Clippy passes with -D warnings
  • No functional changes, only refactoring

Copilot AI review requested due to automatic review settings October 18, 2025 17:45

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

Refactor to simplify the derive macro implementation and address remaining clippy warnings; this PR also bumps crate versions to 0.1.6 to reflect the changes.

  • Bump gonfig and gonfig_derive crate versions to 0.1.6
  • Align published versions across crates

Reviewed Changes

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

File Description
gonfig_derive/Cargo.toml Bump derive crate version to 0.1.6
Cargo.toml Bump main crate version to 0.1.6

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@0xvasanth
0xvasanth merged commit 8f4b560 into main Oct 18, 2025
6 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