Skip to content

Commit b20b3cb

Browse files
authored
Assert that no unsafe code is used in tower (#621)
The tower crates do not include any `unsafe` code, but tools like [`cargo-geiger`][cg] can't necessarily detect that. This change adds a stronger assertion at the top of each crate with a `#![forbid(unsafe_code)]` directive to assert that no unsafe code is used in the crate. This also serves as a more obvious obstacle to introducing unsafe code in future changes. [cg]: https://github.com/rust-secure-code/cargo-geiger
1 parent 2d16720 commit b20b3cb

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

tower-layer/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
rust_2018_idioms,
66
unreachable_pub
77
)]
8+
#![forbid(unsafe_code)]
89
// `rustdoc::broken_intra_doc_links` is checked on CI
910

1011
//! Layer traits and extensions.

tower-service/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
rust_2018_idioms,
66
unreachable_pub
77
)]
8+
#![forbid(unsafe_code)]
89
// `rustdoc::broken_intra_doc_links` is checked on CI
910

1011
//! Definition of the core `Service` trait to Tower

tower-test/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
rust_2018_idioms,
66
unreachable_pub
77
)]
8+
#![forbid(unsafe_code)]
89
#![allow(elided_lifetimes_in_paths)]
910
// `rustdoc::broken_intra_doc_links` is checked on CI
1011

tower/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
rust_2018_idioms,
66
unreachable_pub
77
)]
8+
#![forbid(unsafe_code)]
89
#![allow(elided_lifetimes_in_paths, clippy::type_complexity)]
910
#![cfg_attr(test, allow(clippy::float_cmp))]
1011
#![cfg_attr(docsrs, feature(doc_cfg))]

0 commit comments

Comments
 (0)