Skip to content

Commit 65fb8e0

Browse files
authored
Merge pull request #870 from rust-embedded/must
move must_use from methods to generic type
2 parents 59b6199 + 4d48e4f commit 65fb8e0

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
77

88
## [Unreleased]
99

10+
- move `must_use` from methods to generic type
11+
1012
## [v0.33.5] - 2024-10-12
1113

1214
- Fix STM32-patched CI

src/generate/generic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ pub mod raw {
147147
}
148148
}
149149

150+
#[must_use = "after creating `FieldWriter` you need to call field value setting method"]
150151
pub struct FieldWriter<'a, REG, const WI: u8, FI = u8, Safety = Unsafe>
151152
where
152153
REG: Writable + RegisterSpec,
@@ -174,6 +175,7 @@ pub mod raw {
174175
}
175176
}
176177

178+
#[must_use = "after creating `BitWriter` you need to call bit setting method"]
177179
pub struct BitWriter<'a, REG, FI = bool, M = BitM>
178180
where
179181
REG: Writable + RegisterSpec,

src/generate/register.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,6 @@ pub fn fields(
13051305
#[doc = ""]
13061306
#[doc = #note]
13071307
#inline
1308-
#[must_use]
13091308
pub fn #name_snake_case(&mut self, n: u8) -> #writer_ty<#regspec_ty> {
13101309
#[allow(clippy::no_effect)]
13111310
[(); #dim][n as usize];
@@ -1326,7 +1325,6 @@ pub fn fields(
13261325
w_impl_items.extend(quote! {
13271326
#[doc = #doc]
13281327
#inline
1329-
#[must_use]
13301328
pub fn #name_snake_case_n(&mut self) -> #writer_ty<#regspec_ty> {
13311329
#writer_ty::new(self, #sub_offset)
13321330
}
@@ -1338,7 +1336,6 @@ pub fn fields(
13381336
w_impl_items.extend(quote! {
13391337
#[doc = #doc]
13401338
#inline
1341-
#[must_use]
13421339
pub fn #name_snake_case(&mut self) -> #writer_ty<#regspec_ty> {
13431340
#writer_ty::new(self, #offset)
13441341
}

0 commit comments

Comments
 (0)