You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have repeatedly run into situations where I want to declare an interface method as requiring the result to be used, but currently, the #[MustUseResult] attribute is not inherited, so I have to place the attribute on every implementation of the method.
Use-cases include nearly every method where the attribute would normally be used, where such method is originally defined on an interface, abstract class, or parent class.
Perhaps, for the rare case where an overriding method differs from its parent in that its return value is probably ignorable, it might make sense to add an optional parameter to the attribute to flip the behavior e.g. #[MustUseResult(false)]. I would not consider this essential, however.
See also #29, which is basically this issue but for the #[Friend] attribute instead.
The text was updated successfully, but these errors were encountered:
I have repeatedly run into situations where I want to declare an interface method as requiring the result to be used, but currently, the
#[MustUseResult]
attribute is not inherited, so I have to place the attribute on every implementation of the method.Use-cases include nearly every method where the attribute would normally be used, where such method is originally defined on an interface, abstract class, or parent class.
Perhaps, for the rare case where an overriding method differs from its parent in that its return value is probably ignorable, it might make sense to add an optional parameter to the attribute to flip the behavior e.g.
#[MustUseResult(false)]
. I would not consider this essential, however.See also #29, which is basically this issue but for the
#[Friend]
attribute instead.The text was updated successfully, but these errors were encountered: