Skip to content

Commit

Permalink
Annotate builder functions with #[must_use] (#2841)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebraham authored Dec 19, 2024
1 parent cde6169 commit 036d08e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions esp-hal-procmacros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ pub fn builder_lite_derive(item: TokenStream) -> TokenStream {

fns.push(quote! {
#[doc = concat!(" Assign the given value to the `", stringify!(#field_ident) ,"` field.")]
#[must_use]
pub fn #function_ident(mut self, #field_ident: #field_type) -> Self {
self.#field_ident = #field_assigns;
self
Expand All @@ -473,6 +474,7 @@ pub fn builder_lite_derive(item: TokenStream) -> TokenStream {
let function_ident = format_ident!("with_{}_none", field_ident);
fns.push(quote! {
#[doc = concat!(" Set the value of `", stringify!(#field_ident), "` to `None`.")]
#[must_use]
pub fn #function_ident(mut self) -> Self {
self.#field_ident = None;
self
Expand Down

0 comments on commit 036d08e

Please sign in to comment.