F-028: refactor: extract binary to lib.rs and enforce #![forbid(unsafe_code)]#28
Open
Sephyi wants to merge 1 commit intodevelopmentfrom
Open
F-028: refactor: extract binary to lib.rs and enforce #![forbid(unsafe_code)]#28Sephyi wants to merge 1 commit intodevelopmentfrom
Sephyi wants to merge 1 commit intodevelopmentfrom
Conversation
The `src/main.rs` binary re-declared `mod app; mod cli; mod config; …`,
which built a second module tree alongside `src/lib.rs`. That second tree
did not inherit the `#![forbid(unsafe_code)]` attribute from `lib.rs`,
leaving the binary half of the crate silently unprotected.
Shrink `main.rs` to a thin entry point that imports from the library
crate (`use commitbee::{App, Cli, error};`) and add
`#![forbid(unsafe_code)]` at its top so both compilation units enforce
the lint. `lib.rs` already declared every module publicly, so no other
file needed updating.
Closes audit entry F-028 from #3.
There was a problem hiding this comment.
Pull request overview
Refactors the CLI binary crate to rely on the library crate (lib.rs) for module structure, and closes the audit gap where #![forbid(unsafe_code)] was enforced in the library but not in the binary crate.
Changes:
- Add
#![forbid(unsafe_code)]tosrc/main.rs. - Remove binary-local
mod ...declarations and importApp,Cli, anderrorfrom thecommitbeelibrary crate.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
refactor: extract binary to lib.rs and enforce #![forbid(unsafe_code)].
Audit context
Closes audit entry F-028 from #3.
Verification
cargo fmt --checkcargo clippy --all-targets --all-features -- -D warningscargo test --all-targets