From 2967fbb4724fa1f6c8896c98c70500bddb4489de Mon Sep 17 00:00:00 2001 From: tottoto Date: Mon, 29 Jul 2024 23:12:55 +0900 Subject: [PATCH] chore: replace legacy numeric constant with corresponding one (#789) --- src/client.rs | 3 +-- src/frame/stream_id.rs | 2 -- src/hpack/table.rs | 2 +- src/proto/streams/counts.rs | 2 -- src/proto/streams/stream.rs | 1 - src/server.rs | 2 +- 6 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/client.rs b/src/client.rs index 86fef1ec8..ffeda6077 100644 --- a/src/client.rs +++ b/src/client.rs @@ -148,7 +148,6 @@ use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use std::time::Duration; -use std::usize; use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt}; use tracing::Instrument; @@ -1070,7 +1069,7 @@ impl Builder { /// /// This function panics if `max` is larger than `u32::MAX`. pub fn max_send_buffer_size(&mut self, max: usize) -> &mut Self { - assert!(max <= std::u32::MAX as usize); + assert!(max <= u32::MAX as usize); self.max_send_buffer_size = max; self } diff --git a/src/frame/stream_id.rs b/src/frame/stream_id.rs index 10a14d3c8..0f427dfb4 100644 --- a/src/frame/stream_id.rs +++ b/src/frame/stream_id.rs @@ -1,5 +1,3 @@ -use std::u32; - /// A stream identifier, as described in [Section 5.1.1] of RFC 7540. /// /// Streams are identified with an unsigned 31-bit integer. Streams diff --git a/src/hpack/table.rs b/src/hpack/table.rs index 3e45f413b..d28ec0510 100644 --- a/src/hpack/table.rs +++ b/src/hpack/table.rs @@ -6,7 +6,7 @@ use http::method::Method; use std::collections::VecDeque; use std::hash::{Hash, Hasher}; -use std::{cmp, mem, usize}; +use std::{cmp, mem}; /// HPACK encoder table #[derive(Debug)] diff --git a/src/proto/streams/counts.rs b/src/proto/streams/counts.rs index fdb07f1cd..a214892b6 100644 --- a/src/proto/streams/counts.rs +++ b/src/proto/streams/counts.rs @@ -1,7 +1,5 @@ use super::*; -use std::usize; - #[derive(Debug)] pub(super) struct Counts { /// Acting as a client or server. This allows us to track which values to diff --git a/src/proto/streams/stream.rs b/src/proto/streams/stream.rs index 43e313647..e139da975 100644 --- a/src/proto/streams/stream.rs +++ b/src/proto/streams/stream.rs @@ -2,7 +2,6 @@ use super::*; use std::task::{Context, Waker}; use std::time::Instant; -use std::usize; /// Tracks Stream related state /// diff --git a/src/server.rs b/src/server.rs index 27f89d41e..b00bc0866 100644 --- a/src/server.rs +++ b/src/server.rs @@ -963,7 +963,7 @@ impl Builder { /// /// This function panics if `max` is larger than `u32::MAX`. pub fn max_send_buffer_size(&mut self, max: usize) -> &mut Self { - assert!(max <= std::u32::MAX as usize); + assert!(max <= u32::MAX as usize); self.max_send_buffer_size = max; self }