Skip to content

Commit

Permalink
Merge pull request #870 from rust-embedded/must
Browse files Browse the repository at this point in the history
move must_use from methods to generic type
  • Loading branch information
burrbull authored Oct 18, 2024
2 parents 59b6199 + 4d48e4f commit 65fb8e0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]

- move `must_use` from methods to generic type

## [v0.33.5] - 2024-10-12

- Fix STM32-patched CI
Expand Down
2 changes: 2 additions & 0 deletions src/generate/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ pub mod raw {
}
}

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

#[must_use = "after creating `BitWriter` you need to call bit setting method"]
pub struct BitWriter<'a, REG, FI = bool, M = BitM>
where
REG: Writable + RegisterSpec,
Expand Down
3 changes: 0 additions & 3 deletions src/generate/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,6 @@ pub fn fields(
#[doc = ""]
#[doc = #note]
#inline
#[must_use]
pub fn #name_snake_case(&mut self, n: u8) -> #writer_ty<#regspec_ty> {
#[allow(clippy::no_effect)]
[(); #dim][n as usize];
Expand All @@ -1326,7 +1325,6 @@ pub fn fields(
w_impl_items.extend(quote! {
#[doc = #doc]
#inline
#[must_use]
pub fn #name_snake_case_n(&mut self) -> #writer_ty<#regspec_ty> {
#writer_ty::new(self, #sub_offset)
}
Expand All @@ -1338,7 +1336,6 @@ pub fn fields(
w_impl_items.extend(quote! {
#[doc = #doc]
#inline
#[must_use]
pub fn #name_snake_case(&mut self) -> #writer_ty<#regspec_ty> {
#writer_ty::new(self, #offset)
}
Expand Down

0 comments on commit 65fb8e0

Please sign in to comment.