Skip to content

Commit 39ef9c0

Browse files
AaronErhardtbilelmoussaoui
authored andcommitted
glib-macros: Mark property getters as #[must_use]
1 parent 406c196 commit 39ef9c0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

glib-macros/src/properties.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,11 @@ fn expand_impl_getset_properties(props: &[PropDesc]) -> Vec<syn::ImplItemFn> {
566566

567567
let getter = p.get.is_some().then(|| {
568568
let span = p.attrs_span;
569-
parse_quote_spanned!(span=> pub fn #ident(&self) -> <#ty as #crate_ident::Property>::Value {
570-
self.property::<<#ty as #crate_ident::Property>::Value>(#stripped_name)
571-
})
569+
parse_quote_spanned!(span=>
570+
#[must_use]
571+
pub fn #ident(&self) -> <#ty as #crate_ident::Property>::Value {
572+
self.property::<<#ty as #crate_ident::Property>::Value>(#stripped_name)
573+
})
572574
});
573575

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

0 commit comments

Comments
 (0)