Skip to content

Commit dc24217

Browse files
committed
Add #[must_use] to HookTriggers/GcIncParams/GcGenParams/ThreadTriggers builders
1 parent 5bf131e commit dc24217

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/debug.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ impl HookTriggers {
309309
/// Returns an instance of `HookTriggers` with [`on_calls`] trigger set.
310310
///
311311
/// [`on_calls`]: #structfield.on_calls
312+
#[must_use]
312313
pub const fn on_calls(mut self) -> Self {
313314
self.on_calls = true;
314315
self
@@ -317,6 +318,7 @@ impl HookTriggers {
317318
/// Returns an instance of `HookTriggers` with [`on_returns`] trigger set.
318319
///
319320
/// [`on_returns`]: #structfield.on_returns
321+
#[must_use]
320322
pub const fn on_returns(mut self) -> Self {
321323
self.on_returns = true;
322324
self
@@ -325,6 +327,7 @@ impl HookTriggers {
325327
/// Returns an instance of `HookTriggers` with [`every_line`] trigger set.
326328
///
327329
/// [`every_line`]: #structfield.every_line
330+
#[must_use]
328331
pub const fn every_line(mut self) -> Self {
329332
self.every_line = true;
330333
self
@@ -333,6 +336,7 @@ impl HookTriggers {
333336
/// Returns an instance of `HookTriggers` with [`every_nth_instruction`] trigger set.
334337
///
335338
/// [`every_nth_instruction`]: #structfield.every_nth_instruction
339+
#[must_use]
336340
pub const fn every_nth_instruction(mut self, n: u32) -> Self {
337341
self.every_nth_instruction = Some(n);
338342
self

src/state.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ impl GcIncParams {
100100
/// Sets the `pause` parameter.
101101
#[cfg(not(feature = "luau"))]
102102
#[cfg_attr(docsrs, doc(cfg(not(feature = "luau"))))]
103+
#[must_use]
103104
pub fn pause(mut self, v: c_int) -> Self {
104105
self.pause = Some(v);
105106
self
@@ -108,12 +109,14 @@ impl GcIncParams {
108109
/// Sets the `goal` parameter.
109110
#[cfg(any(feature = "luau", doc))]
110111
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
112+
#[must_use]
111113
pub fn goal(mut self, v: c_int) -> Self {
112114
self.goal = Some(v);
113115
self
114116
}
115117

116118
/// Sets the `step_multiplier` parameter.
119+
#[must_use]
117120
pub fn step_multiplier(mut self, v: c_int) -> Self {
118121
self.step_multiplier = Some(v);
119122
self
@@ -122,6 +125,7 @@ impl GcIncParams {
122125
/// Sets the `step_size` parameter.
123126
#[cfg(any(feature = "lua55", feature = "lua54", feature = "luau"))]
124127
#[cfg_attr(docsrs, doc(cfg(any(feature = "lua55", feature = "lua54", feature = "luau"))))]
128+
#[must_use]
125129
pub fn step_size(mut self, v: c_int) -> Self {
126130
self.step_size = Some(v);
127131
self
@@ -155,12 +159,14 @@ pub struct GcGenParams {
155159
#[cfg(any(feature = "lua55", feature = "lua54"))]
156160
impl GcGenParams {
157161
/// Sets the `minor_multiplier` parameter.
162+
#[must_use]
158163
pub fn minor_multiplier(mut self, v: c_int) -> Self {
159164
self.minor_multiplier = Some(v);
160165
self
161166
}
162167

163168
/// Sets the `minor_to_major` threshold.
169+
#[must_use]
164170
pub fn minor_to_major(mut self, v: c_int) -> Self {
165171
self.minor_to_major = Some(v);
166172
self
@@ -169,6 +175,7 @@ impl GcGenParams {
169175
/// Sets the `major_to_minor` parameter.
170176
#[cfg(feature = "lua55")]
171177
#[cfg_attr(docsrs, doc(cfg(feature = "lua55")))]
178+
#[must_use]
172179
pub fn major_to_minor(mut self, v: c_int) -> Self {
173180
self.major_to_minor = Some(v);
174181
self

src/thread.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,21 @@ impl ThreadTriggers {
9595
}
9696

9797
/// Returns an instance of `ThreadTriggers` with `on_create` trigger set.
98+
#[must_use]
9899
pub const fn on_create(mut self) -> Self {
99100
self.on_create = true;
100101
self
101102
}
102103

103104
/// Returns an instance of `ThreadTriggers` with `on_resume` trigger set.
105+
#[must_use]
104106
pub const fn on_resume(mut self) -> Self {
105107
self.on_resume = true;
106108
self
107109
}
108110

109111
/// Returns an instance of `ThreadTriggers` with `on_yield` trigger set.
112+
#[must_use]
110113
pub const fn on_yield(mut self) -> Self {
111114
self.on_yield = true;
112115
self

0 commit comments

Comments
 (0)