Skip to content

Commit b8ddea7

Browse files
tottotoseanmonstar
authored andcommitted
refactor(header): add comment and lint allowing to panic in const context workaround
1 parent fe1932d commit b8ddea7

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/header/name.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,12 @@ impl HeaderName {
12691269
i += 1;
12701270
}
12711271
} {
1272+
// TODO: When msrv is bumped to larger than 1.57, this should be
1273+
// replaced with `panic!` macro.
1274+
// https://blog.rust-lang.org/2021/12/02/Rust-1.57.0.html#panic-in-const-contexts
1275+
//
1276+
// See the panics section of this method's document for details.
1277+
#[allow(clippy::no_effect)]
12721278
([] as [u8; 0])[0]; // Invalid header name
12731279
}
12741280

src/header/value.rs

+6
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ impl HeaderValue {
8686
let mut i = 0;
8787
while i < bytes.len() {
8888
if !is_visible_ascii(bytes[i]) {
89+
// TODO: When msrv is bumped to larger than 1.57, this should be
90+
// replaced with `panic!` macro.
91+
// https://blog.rust-lang.org/2021/12/02/Rust-1.57.0.html#panic-in-const-contexts
92+
//
93+
// See the panics section of this method's document for details.
94+
#[allow(clippy::no_effect)]
8995
([] as [u8; 0])[0]; // Invalid header value
9096
}
9197
i += 1;

0 commit comments

Comments
 (0)