Skip to content

Commit

Permalink
glib-macros: Mark property getters as #[must_use]
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronErhardt authored and bilelmoussaoui committed Sep 19, 2023
1 parent 406c196 commit 39ef9c0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions glib-macros/src/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,11 @@ fn expand_impl_getset_properties(props: &[PropDesc]) -> Vec<syn::ImplItemFn> {

let getter = p.get.is_some().then(|| {
let span = p.attrs_span;
parse_quote_spanned!(span=> pub fn #ident(&self) -> <#ty as #crate_ident::Property>::Value {
self.property::<<#ty as #crate_ident::Property>::Value>(#stripped_name)
})
parse_quote_spanned!(span=>
#[must_use]
pub fn #ident(&self) -> <#ty as #crate_ident::Property>::Value {
self.property::<<#ty as #crate_ident::Property>::Value>(#stripped_name)
})
});

let setter = (p.set.is_some() && !p.is_construct_only).then(|| {
Expand Down

0 comments on commit 39ef9c0

Please sign in to comment.