Skip to content

Conversation

@m4tx
Copy link
Collaborator

@m4tx m4tx commented Nov 21, 2025

No description provided.


impl<'a> FdtProperty<'a> {
/// Returns the name of this property.
#[must_use]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this (and value) must_use? It would be pointless to call it and ignore the return value, sure, but it's not like you're failing to check for an error condition or something like that.

Copy link
Collaborator Author

@m4tx m4tx Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the usage of #[must_use] used to be very inconsistent in the Rust ecosystem and has been a topic of discussion for quite a long time. The reference, however, doesn't specify when exactly should the attribute be used.

Nowadays, it seems like the Rust standard library follows something in the lines of "if the function has no side-effects, it should warn when the result is discarded". A while ago over 800 attributes have been added, and you can see that methods such as str::len, or f32::is_nan (or honestly, many many others) do have the attribute. Hence I'm following this to be consistent with the standard library.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, fair enough.

Base automatically changed from fdt-nodes to main December 9, 2025 10:05
@m4tx m4tx requested a review from qwandor December 9, 2025 10:37
@m4tx m4tx merged commit bdf1e1d into main Dec 9, 2025
25 checks passed
@m4tx m4tx deleted the fdt-properties branch December 9, 2025 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants