Skip to content

Commit 79dbab6

Browse files
authored
style(ext): fix manual_assert lint (#4079)
As per #4071 fix instances where the manual_assert lint triggered on the code. This was able to be done with a `clippy --fix` with further cleanup to change `!<expr>.is_some()` in the assert to `<expr>.is_none()`.
1 parent cca6bf1 commit 79dbab6

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ integer_division = "allow"
134134
integer_division_remainder_used = "allow"
135135
large_enum_variant = "allow"
136136
let_unit_value = "allow"
137-
manual_assert = "allow" # TODO: easy fix
138137
manual_assert_eq = "allow" # TODO: easy fix
139138
map_err_ignore = "allow"
140139
map_unwrap_or = "allow"

src/ext/h1_reason_phrase.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ impl ReasonPhrase {
4242
/// Converts a static byte slice to a reason phrase.
4343
pub const fn from_static(reason: &'static [u8]) -> Self {
4444
// TODO: this can be made const once MSRV is >= 1.57.0
45-
if find_invalid_byte(reason).is_some() {
46-
panic!("invalid byte in static reason phrase");
47-
}
45+
assert!(
46+
find_invalid_byte(reason).is_none(),
47+
"invalid byte in static reason phrase"
48+
);
4849
Self(Bytes::from_static(reason))
4950
}
5051

0 commit comments

Comments
 (0)