Skip to content

Commit

Permalink
Enable the rustc unsafe_code lint (#749)
Browse files Browse the repository at this point in the history
To help make any usages of unsafe more obvious, since they will
now require the addition of an `allow` attribute (and ideally an
explaining comment).

See:
https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unsafe-code
  • Loading branch information
edmorley authored Nov 17, 2023
1 parent 02f241c commit cb0454f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ edition = "2021"
license = "BSD-3-Clause"

[workspace.lints.rust]
unsafe_code = "warn"
unused_crate_dependencies = "warn"

[workspace.lints.clippy]
Expand Down
1 change: 1 addition & 0 deletions libcnb/src/exec_d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub fn write_exec_d_program_output<O: Into<ExecDProgramOutput>>(o: O) {
// actually mapped to something. Since we're implementing the CNB spec and it explicitly
// tells us to write to that file descriptor, this is safe to do without additional
// validation in this context.
#[allow(unsafe_code)]
let output_file = unsafe { File::from_raw_fd(3) };

let serialized_output = toml::to_string(&o.into())
Expand Down

0 comments on commit cb0454f

Please sign in to comment.