Skip to content

Commit

Permalink
Add #![forbid(unsafe_code)].
Browse files Browse the repository at this point in the history
The newly added `#![forbid(unsafe_code)]` directive serves two purposes:

* It explicitly documents the current state of the crate (i.e. currently
  there is no `unsafe`) which helps security reviewers to check the
  overall safety profile / approach of the crate.
* It adds an extra speed bump in case `unsafe` PRs are considered in the
  future. Hopefully in most cases `unsafe` can be encapsulated in
  separate (small, auditable) crates that `qr_code` can depend on (and
  the `forbid` directive can give a gentle nudge in this direction).
  • Loading branch information
anforowicz committed Apr 21, 2023
1 parent cf9c620 commit 130c586
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#![cfg_attr(feature = "bench", doc(include = "../README.md"))]
// ^ make sure we can test our README.md.
#![cfg_attr(docsrs, feature(doc_cfg))]
// No `unsafe` please. If `unsafe` is really needed, then please
// consider encapsulating it in a separate crates.io crate.
#![forbid(unsafe_code)]

// Re-exported dependencies.
#[cfg(feature = "bmp")]
Expand Down

0 comments on commit 130c586

Please sign in to comment.