Skip to content

Commit ebed573

Browse files
authored
Add #[must_use] to All Custom Futures (#104)
Without this it's very easy to forget awaiting the futures, leading to possibly long debugging sessions.
1 parent 2ab38e8 commit ebed573

File tree

9 files changed

+9
-0
lines changed

9 files changed

+9
-0
lines changed

src/emulator/gba/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ impl Emulator {
180180
}
181181

182182
/// A future that executes a future until the emulator closes.
183+
#[must_use = "You need to await this future."]
183184
pub struct UntilEmulatorCloses<'a, F> {
184185
emulator: &'a Emulator,
185186
future: F,

src/emulator/gcn/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ impl Emulator {
150150
}
151151

152152
/// A future that executes a future until the emulator closes.
153+
#[must_use = "You need to await this future."]
153154
pub struct UntilEmulatorCloses<'a, F> {
154155
emulator: &'a Emulator,
155156
future: F,

src/emulator/genesis/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ impl Emulator {
166166
}
167167

168168
/// A future that executes a future until the emulator closes.
169+
#[must_use = "You need to await this future."]
169170
pub struct UntilEmulatorCloses<'a, F> {
170171
emulator: &'a Emulator,
171172
future: F,

src/emulator/ps1/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ impl Emulator {
151151
}
152152

153153
/// A future that executes a future until the emulator closes.
154+
#[must_use = "You need to await this future."]
154155
pub struct UntilEmulatorCloses<'a, F> {
155156
emulator: &'a Emulator,
156157
future: F,

src/emulator/ps2/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ impl Emulator {
146146
}
147147

148148
/// A future that executes a future until the emulator closes.
149+
#[must_use = "You need to await this future."]
149150
pub struct UntilEmulatorCloses<'a, F> {
150151
emulator: &'a Emulator,
151152
future: F,

src/emulator/sms/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ impl Emulator {
130130
}
131131

132132
/// A future that executes a future until the emulator closes.
133+
#[must_use = "You need to await this future."]
133134
pub struct UntilEmulatorCloses<'a, F> {
134135
emulator: &'a Emulator,
135136
future: F,

src/emulator/wii/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ impl Emulator {
231231
}
232232

233233
/// A future that executes a future until the emulator closes.
234+
#[must_use = "You need to await this future."]
234235
pub struct UntilEmulatorCloses<'a, F> {
235236
emulator: &'a Emulator,
236237
future: F,

src/future/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ impl<const N: usize> Signature<N> {
271271
}
272272

273273
/// A future that executes a future until the process closes.
274+
#[must_use = "You need to await this future."]
274275
pub struct UntilProcessCloses<'a, F> {
275276
process: &'a Process,
276277
future: F,

src/future/time.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ pub fn sleep(duration: Duration) -> Sleep {
115115
/// // the future timed out
116116
/// }
117117
/// ```
118+
#[must_use = "You need to await this future."]
118119
pub struct Timeout<F> {
119120
sleep: Sleep,
120121
future: F,

0 commit comments

Comments
 (0)