Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve discoverability with expect! as alias for unwrap! #872

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dvdsk
Copy link

@dvdsk dvdsk commented Oct 9, 2024

See related issue: #867 Its easy to assume unwrap! can not have a message like std's expect.

Adding an expect macro will help both autocomplete guide programmers looking for one and those who discount the unwrap entry in the defmt api docs based on their knowledge that std's unwrap can not have a message.

The documentation of the expect alias highlights that unwrap works with a message to and points to the unwrap macro docs for details.

See related issue: knurling-rs#867
Its easy to assume unwrap! can not have a message like std's expect.

Adding an expect macro will help both autocomplete guide programmers
looking for one and those who discount the unwrap entry in the defmt
api docs based on their knowledge that std's unwrap can not have a
message.

The documentation of the expect alias highlights that unwrap works with
a message to and points to the unwrap macro docs for details.
@dvdsk
Copy link
Author

dvdsk commented Oct 9, 2024

pretty sure CI breaking is unrelated since this PR is only 1 use line + some lines of comments

@dvdsk
Copy link
Author

dvdsk commented Oct 9, 2024

possible discussion point: because its an alias expect can be used without a message. Therefore you can not easily forbid unwrap's without a message by checking for the unwrap string.

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.

1 participant