Skip to content

Commit

Permalink
chore: allow clippy for MSRV 1.81 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kolbma committed Sep 23, 2024
1 parent 37cda9c commit 15ac014
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/common/content_type.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg(feature = "content-type")]
// #![cfg(feature = "content-type")]

use ascii::{AsciiStr, AsciiString};
use std::collections::HashMap;
Expand Down Expand Up @@ -215,6 +215,7 @@ impl TryFrom<&AsciiStr> for ContentType {
}

#[cfg(test)]
#[cfg(feature = "content-type")]
mod tests {
use std::{convert::TryFrom, str::FromStr};

Expand All @@ -223,6 +224,7 @@ mod tests {
use super::{content_type_lookup, CONTENT_TYPES};

#[test]
#[allow(clippy::const_is_empty)]
fn content_types_test() {
assert!(!CONTENT_TYPES.is_empty());
for (n, mt) in CONTENT_TYPES.iter().enumerate() {
Expand All @@ -236,6 +238,7 @@ mod tests {
}

#[test]
#[allow(clippy::const_is_empty)]
fn content_type_lookup_test() {
assert!(!CONTENT_TYPES.is_empty());
for mt in CONTENT_TYPES {
Expand Down
3 changes: 2 additions & 1 deletion src/common/range_header.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg(feature = "range-support")]
// #![cfg(feature = "range-support")]
//! HTTP/1.1 supports [Range Requests](https://datatracker.ietf.org/doc/html/rfc9110#name-range-requests)
use std::convert::TryFrom;
Expand Down Expand Up @@ -623,6 +623,7 @@ pub(crate) mod response {
}

#[cfg(test)]
#[cfg(feature = "range-support")]
mod tests {
use std::str::FromStr;

Expand Down
7 changes: 6 additions & 1 deletion src/response/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ macro_rules! number_to_bytes {

while n > 0 {
idx -= 1;
#[allow(clippy::cast_possible_truncation, trivial_numeric_casts)]
#[allow(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
trivial_numeric_casts
)]
// truncation intended
{
digits[idx] = (n % 10) as u8 + 48;
Expand Down Expand Up @@ -300,6 +304,7 @@ pub(super) fn write_body<R: Read, W: Write>(
}

#[inline]
#[allow(clippy::byte_char_slices)]
pub(super) fn write_message_header<W>(
writer: &mut W,
http_version: HttpVersion,
Expand Down
1 change: 1 addition & 0 deletions tests/non-chunked-buffering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ fn big_response_reader() -> Reader {

fn identity_served(r: &mut Reader) -> tiny_http::Response<&mut Reader> {
let body_len = r.inner.get_ref().len();
#[allow(clippy::legacy_numeric_constants)]
tiny_http::Response::empty(200)
.with_chunked_threshold(std::usize::MAX)
.with_data(r, Some(body_len))
Expand Down

0 comments on commit 15ac014

Please sign in to comment.