Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/resp_codec_impl/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn encode_frame_at(frame: &RespFrame, dst: &mut BytesMut, depth: usize) -> Resul
fn digits_len_usize(mut value: usize) -> usize {
let mut digits = 1;
while value >= 10 {
value /= 10;
value = value.div_euclid(10);
digits += 1;
}
digits
Expand All @@ -125,7 +125,7 @@ fn digits_len_i64(value: i64) -> usize {
let mut digits = 1;
let mut cursor = value;
while cursor <= -10 || cursor >= 10 {
cursor /= 10;
cursor = cursor.div_euclid(10);
digits += 1;
}
if value < 0 { digits + 1 } else { digits }
Expand Down
2 changes: 1 addition & 1 deletion examples/resp_codec_impl/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const MAX_RECURSION_DEPTH: usize = 64;
fn decimal_digits(mut value: usize) -> usize {
let mut digits = 1;
while value >= 10 {
value /= 10;
value = value.div_euclid(10);
digits += 1;
}
digits
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2026-03-26"
channel = "nightly-2026-10-22"
components = ["rustfmt", "clippy", "rust-analyzer", "rustc-codegen-cranelift-preview"]
3 changes: 1 addition & 2 deletions src/app/builder/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ where
pub fn protocol_hooks(&self) -> ProtocolHooks<F::Frame, ()> {
self.protocol
.as_ref()
.map(ProtocolHooks::from_protocol)
.unwrap_or_default()
.map_or_else(ProtocolHooks::default, ProtocolHooks::from_protocol)
}

/// Get the configured message assembler, if any.
Expand Down
2 changes: 1 addition & 1 deletion src/app/codec_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ mod tests {
assert_eq!(first.len(), 1);

let second = pipeline.drain_output();
assert!(second.is_empty());
assert_eq!(second, [] as [crate::app::Envelope; 0]);
}

#[rstest]
Expand Down
10 changes: 8 additions & 2 deletions src/app/inbound_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ where
/// # Errors
///
/// Returns an [`io::Error`] if stream processing or handler execution fails.
#[deprecated(note = "prepare the app once, then call PreparedApp::handle_connection_result")]
#[deprecated(
since = "0.3.0",
note = "prepare the app once, then call PreparedApp::handle_connection_result"
)]
pub async fn handle_connection_result<W>(&self, stream: W) -> io::Result<()>
where
W: AsyncRead + AsyncWrite + Send + Unpin + 'static,
Expand All @@ -187,7 +190,10 @@ where
}

/// Handle a connection through the compatibility preparation path.
#[deprecated(note = "prepare the app once, then call PreparedApp::handle_connection")]
#[deprecated(
since = "0.3.0",
note = "prepare the app once, then call PreparedApp::handle_connection"
)]
pub async fn handle_connection<W>(&self, stream: W)
where
W: AsyncRead + AsyncWrite + Send + Unpin + 'static,
Expand Down
8 changes: 4 additions & 4 deletions src/app/prepared_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,10 @@ where
/// ```
#[must_use]
pub fn protocol_hooks(&self) -> crate::hooks::ProtocolHooks<F::Frame, ()> {
self.protocol
.as_ref()
.map(crate::hooks::ProtocolHooks::from_protocol)
.unwrap_or_default()
self.protocol.as_ref().map_or_else(
crate::hooks::ProtocolHooks::default,
crate::hooks::ProtocolHooks::from_protocol,
)
}

/// Get the configured message assembler, if any.
Expand Down
2 changes: 1 addition & 1 deletion src/client/pool/lease.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ where
self.pending_responses.fetch_add(1, Ordering::AcqRel);
}
PendingResponseChange::Remove => {
let _ = self.pending_responses.fetch_update(
let _ = self.pending_responses.try_update(
Ordering::AcqRel,
Ordering::Acquire,
|pending| Some(pending.saturating_sub(1)),
Expand Down
4 changes: 0 additions & 4 deletions src/client/pool/scheduler/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ where
}

/// Race slot capacity against shutdown or cancellation for one waiter.
#[expect(
clippy::integer_division_remainder_used,
reason = "tokio::select! macro internally uses % for random branch selection"
)]
async fn service_one_waiter(
&self,
mut sender: WaiterSender<S, P, C>,
Expand Down
4 changes: 0 additions & 4 deletions src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,6 @@ where
///
/// The `strict_priority_order` and `shutdown_signal_precedence` tests
/// assert that this ordering is preserved across refactors.
#[expect(
clippy::integer_division_remainder_used,
reason = "tokio::select! expands to modulus operations internally"
)]
async fn next_event(&mut self, state: &ActorState) -> Event<F, E> {
let avail = self.compute_availability(state);
let can_poll_multi_packet = avail.output == AvailableOutput::MultiPacket;
Expand Down
1 change: 0 additions & 1 deletion src/extractor/streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ impl StreamingBody {
///
/// Use this when you need direct access to the stream for custom
/// processing with [`futures::StreamExt`] methods.
#[must_use]
pub fn into_stream(self) -> crate::request::RequestBodyStream { self.stream }

/// Convert to an [`AsyncRead`] adapter.
Expand Down
2 changes: 1 addition & 1 deletion src/fragment/fragmenter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl Fragmenter {
pub fn next_message_id(&self) -> MessageId {
match self
.next_message_id
.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| {
.try_update(Ordering::Relaxed, Ordering::Relaxed, |current| {
current.checked_add(1)
}) {
Ok(previous) => MessageId::new(previous),
Expand Down
2 changes: 1 addition & 1 deletion src/fragment/tests/fragmenter_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn fragmenter_handles_empty_payload() {
.fragments()
.first()
.expect("batch should contain at least one fragment");
assert!(fragment.payload().is_empty());
assert_eq!(fragment.payload(), []);
assert!(fragment.header().is_last_fragment());
assert_eq!(fragment.header().fragment_index(), FragmentIndex::zero());
}
Expand Down
2 changes: 1 addition & 1 deletion src/preamble/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async fn bounded_preamble_preserves_valid_containers_and_following_bytes(#[case]
.await
.expect("preamble within the budget must decode");
assert_eq!(decoded, value);
assert!(leftover.is_empty());
assert_eq!(leftover, [] as [u8; 0]);
assert_eq!(reader.position(), encoded_len as u64);
assert!(encoded_len <= MAX_PREAMBLE_LEN);
assert_eq!(
Expand Down
4 changes: 0 additions & 4 deletions src/push/queues/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,6 @@ impl<F: FrameLike> PushQueues<F> {
/// assert_eq!(frame, 2);
/// }
/// ```
#[expect(
clippy::integer_division_remainder_used,
reason = "tokio::select! expands to modulus internally"
)]
pub async fn recv(&mut self) -> Option<(PushPriority, F)> {
let mut high_closed = false;
let mut low_closed = false;
Expand Down
2 changes: 0 additions & 2 deletions src/request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ pub const DEFAULT_BODY_CHANNEL_CAPACITY: usize = 16;
/// // tx: send chunks from connection
/// // rx: consume in handler
/// ```
#[must_use]
pub fn body_channel(
capacity: usize,
) -> (mpsc::Sender<Result<Bytes, io::Error>>, RequestBodyStream) {
Expand Down Expand Up @@ -178,7 +177,6 @@ impl RequestBodyReader {
/// **Safe to call when:** the reader has been fully drained (all reads
/// returned zero bytes or an error), or when deliberately abandoning
/// any remaining buffered content.
#[must_use]
pub fn into_inner(self) -> RequestBodyStream { self.inner.into_inner() }
}
impl AsyncRead for RequestBodyReader {
Expand Down
2 changes: 1 addition & 1 deletion src/request/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ fn inherit_correlation_variants(
#[rstest]
fn empty_metadata_is_valid() {
let parts = RequestParts::new(1, None, vec![]);
assert!(parts.metadata().is_empty());
assert_eq!(parts.metadata(), []);
}
1 change: 0 additions & 1 deletion src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ impl<F: Send + 'static, E: Send + 'static> Response<F, E> {
/// assert_eq!(frames, vec![1]);
/// # }
/// ```
#[must_use]
pub fn into_stream(self) -> FrameStream<F, E> {
match self {
Response::Single(f) => {
Expand Down
4 changes: 0 additions & 4 deletions src/server/runtime/accept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ fn record_accept_loop_exit(shutdown: &CancellationToken, lifecycle: &SupervisorL
}

/// Select between shutdown and one accept attempt, returning the next delay.
#[expect(
clippy::integer_division_remainder_used,
reason = "tokio::select! expands to modulus internally"
)]
async fn accept_iteration<T, L, Ser, Ctx, E, Codec>(
listener: &Arc<L>,
handles: &AcceptHandles<'_, T, Ser, Ctx, E, Codec>,
Expand Down
4 changes: 0 additions & 4 deletions src/server/runtime/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ where
S: Future<Output = ()> + Send,
{
let mut shutdown = Box::pin(shutdown);
#[expect(
clippy::integer_division_remainder_used,
reason = "tokio::select! expands to modulus internally"
)]
let startup_result = select! {
() = &mut shutdown => {
record_server_startup_duration(
Expand Down
4 changes: 0 additions & 4 deletions src/server/runtime/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ impl Drop for SupervisorCancellationDropGuard<'_> {
}

/// Wait for deliberate shutdown or for all tracked workers to complete.
#[expect(
clippy::integer_division_remainder_used,
reason = "tokio::select! expands to modulus internally"
)]
pub(super) async fn await_supervisor_termination<S>(
shutdown: S,
shutdown_token: &CancellationToken,
Expand Down
2 changes: 1 addition & 1 deletion tests/connection_actor_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ async fn protocol_error_logs_warning(
.run(&mut out)
.await
.map_err(|e| io::Error::other(format!("actor run failed: {e:?}")))?;
assert!(out.is_empty());
assert_eq!(out, [] as [u8; 0]);
let mut found = false;
while let Some(record) = logger.pop() {
if record.level() == log::Level::Warn && record.args().contains("protocol error") {
Expand Down
2 changes: 1 addition & 1 deletion tests/connection_actor_shutdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async fn shutdown_signal_precedence(
// drop the handle after actor creation to mimic early disconnection
let mut out = Vec::new();
actor.run(&mut out).await.expect("actor run failed");
assert!(out.is_empty());
assert_eq!(out, [] as [u8; 0]);
}

#[rstest]
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/client_tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ impl ClientTracingWorld {

/// Return the peer address string.
pub fn peer_addr_string(&self) -> String {
self.addr.map(|a| a.to_string()).unwrap_or_default()
self.addr.map_or_else(String::new, |a| a.to_string())
}

/// Check whether captured tracing output contains a needle.
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/multi_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl MultiPacketWorld {
/// # Panics
/// Panics if any messages are present.
pub fn verify_empty(&self) {
assert!(self.messages.is_empty());
assert_eq!(self.messages, [] as [u8; 0]);
}

/// Verify messages were received in order.
Expand Down
1 change: 0 additions & 1 deletion tests/formal_tooling/targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ proptest! {
let expected = candidate
.split('.')
.collect::<Vec<_>>()
.as_slice()
.iter()
.copied()
.all(|part| !part.is_empty() && part.chars().all(|character| character.is_ascii_digit()))
Expand Down
2 changes: 1 addition & 1 deletion tests/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async fn middleware_modifies_request_and_response_preserves_cid(correlation_id:

#[tokio::test]
async fn from_fn_clones_captured_state_across_routes() {
let marker = Arc::new([b'!', b'?']);
let marker = Arc::new(*b"!?");
let middleware = from_fn(
move |mut request: ServiceRequest, _next: Next<'_, HandlerService<Envelope>>| {
let [request_marker, response_marker] = marker.as_ref();
Expand Down
4 changes: 0 additions & 4 deletions tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ async fn dropping_server_supervisor_releases_listener() -> TestResult {
.run_with_shutdown(std::future::pending()),
);

#[expect(
clippy::integer_division_remainder_used,
reason = "tokio::select! expands to modulus internally"
)]
let readiness: TestResult = timeout(Duration::from_secs(1), async {
tokio::select! {
readiness = &mut ready_rx => {
Expand Down
4 changes: 0 additions & 4 deletions tests/server_lifecycle_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@ async fn drop_supervisor(requested_workers: usize) -> TestResult {
.ready_signal(ready_tx)
.run_with_shutdown(future::pending()),
);
#[expect(
clippy::integer_division_remainder_used,
reason = "tokio::select! expands to modulus internally"
)]
let readiness: TestResult = timeout(Duration::from_secs(1), async {
tokio::select! {
ready = &mut ready_rx => ready.map_err(|error| {
Expand Down
4 changes: 0 additions & 4 deletions tests/server_lifecycle_observability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ async fn drop_supervisor() -> TestResult {
.ready_signal(ready_tx)
.run_with_shutdown(future::pending()),
);
#[expect(
clippy::integer_division_remainder_used,
reason = "tokio::select! expands to modulus internally"
)]
let readiness: TestResult = timeout(Duration::from_secs(1), async {
tokio::select! {
ready = &mut ready_rx => ready.map_err(|error| {
Expand Down
2 changes: 1 addition & 1 deletion tests/steps/client_request_hooks_steps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ define_counter_step!(
#[then("the markers appear in registration order")]
fn then_markers_in_order(client_request_hooks_world: &mut ClientRequestHooksWorld) -> TestResult {
let log = client_request_hooks_world.marker_log()?;
if log != [b'A', b'B'] {
if log != *b"AB" {
return Err(format!("expected markers [A, B] in registration order, got {log:?}").into());
}
Ok(())
Expand Down
Loading
Loading