Skip to content

Commit 956e350

Browse files
committed
move must_use from methods to generic type
1 parent 59b6199 commit 956e350

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
@@ -333,6 +333,7 @@ pub struct RangeFrom<const MIN: u64>;
333333
pub struct RangeTo<const MAX: u64>;
334334

335335
/// Write field Proxy
336+
#[must_use = "after creating `BitWriter` you need to call field value setting method"]
336337
pub type FieldWriter<'a, REG, const WI: u8, FI = u8, Safety = Unsafe> = raw::FieldWriter<'a, REG, WI, FI, Safety>;
337338

338339
impl<'a, REG, const WI: u8, FI, Safety> FieldWriter<'a, REG, WI, FI, Safety>
@@ -461,6 +462,7 @@ macro_rules! bit_proxy {
461462
pub struct $mwv;
462463

463464
/// Bit-wise write field proxy
465+
#[must_use = "after creating `BitWriter` you need to call bit setting method"]
464466
pub type $writer<'a, REG, FI = bool> = raw::BitWriter<'a, REG, FI, $mwv>;
465467

466468
impl<'a, REG, FI> $writer<'a, REG, FI>

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)