From 61694980ce2818be244fbc31bb94099567d08a88 Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Thu, 30 Oct 2025 16:05:43 -0700 Subject: [PATCH 1/3] General updates, cleanups, and fixes - Updates to Edition 2024 - Fixes warnings in test code --- Cargo.toml | 2 +- rustfmt.toml | 2 +- src/tests.rs | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6eff27e..f096c6e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ name = "stackfuture" description = "StackFuture is a wrapper around futures that stores the wrapped future in space provided by the caller." version = "0.3.0" -edition = "2021" +edition = "2024" license = "MIT" authors = ["Microsoft"] repository = "https://github.com/microsoft/stackfuture" diff --git a/rustfmt.toml b/rustfmt.toml index a15352f..c7ef391 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,2 +1,2 @@ -edition = "2021" +edition = "2024" reorder_imports = true diff --git a/src/tests.rs b/src/tests.rs index 56b01e2..449e182 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -103,6 +103,7 @@ fn test_alignment() { // A test to make sure we store the wrapped future with the correct alignment #[repr(align(8))] + #[allow(dead_code)] struct BigAlignment(u32); impl Future for BigAlignment { @@ -121,6 +122,7 @@ fn test_alignment_failure() { // A test to make sure we store the wrapped future with the correct alignment #[repr(align(256))] + #[allow(dead_code)] struct BigAlignment(u32); impl Future for BigAlignment { From cc62e8448e4e3ab5bfc9f243ec7c1ed7716fd687 Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Thu, 30 Oct 2025 16:07:29 -0700 Subject: [PATCH 2/3] cargo fmt --- src/lib.rs | 9 ++++++--- src/tests.rs | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 12d8173..dd54a1c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -378,19 +378,22 @@ impl IntoStackFutureError { impl Display for IntoStackFutureError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match (self.alignment_too_small(), self.insufficient_space()) { - (true, true) => write!(f, + (true, true) => write!( + f, "cannot create StackFuture, required size is {}, available space is {}; required alignment is {} but maximum alignment is {}", self.required_space(), self.available_space(), self.required_alignment(), self.available_alignment() ), - (true, false) => write!(f, + (true, false) => write!( + f, "cannot create StackFuture, required alignment is {} but maximum alignment is {}", self.required_alignment(), self.available_alignment() ), - (false, true) => write!(f, + (false, true) => write!( + f, "cannot create StackFuture, required size is {}, available space is {}", self.required_space(), self.available_space() diff --git a/src/tests.rs b/src/tests.rs index 449e182..6f17dfc 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1,12 +1,12 @@ use crate::StackFuture; use core::task::Poll; -use futures::channel::mpsc; -use futures::executor::block_on; -use futures::pin_mut; use futures::Future; use futures::SinkExt; use futures::Stream; use futures::StreamExt; +use futures::channel::mpsc; +use futures::executor::block_on; +use futures::pin_mut; use std::sync::Arc; use std::task::Context; use std::task::Wake; From b2eb5a9bdd402b1e6f3c16660b63fc9401450e36 Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Thu, 30 Oct 2025 16:13:31 -0700 Subject: [PATCH 3/3] Fix another dead_code issue --- src/tests.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests.rs b/src/tests.rs index 6f17dfc..87288f4 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -144,6 +144,7 @@ fn test_boxed_alignment() { // A test to make sure we store the wrapped future with the correct alignment #[repr(align(256))] + #[allow(dead_code)] struct BigAlignment(u32); impl Future for BigAlignment {