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

Veetaha's amendments for #[builder(getter)] #226

Merged
merged 4 commits into from
Dec 1, 2024

Conversation

Veetaha
Copy link
Collaborator

@Veetaha Veetaha commented Dec 1, 2024

Followup for #222

Did the following changes:

  • Added typos to pre-commit hook and init.sh as well. Updated typos version, fixed some new typos.
  • Made the tests #![no_std] compatible
  • Added the test for #[builder(getter, default)] attributes combo
  • Added negative trybuild tests to make sure methods aren't accessible until values are set, and mutual exclusion checks work
  • Added #[must_use] to getters. Added a negative test to warnings.rs test case to make sure it works.
  • Inverted the attributes config validation to use validate_mutually_exclusive. All other attributes such as finish_fn, start_fn, skip already have their own validate_mutually_alllowed blocks, so they already reject getter with them.
  • Renamed getter.rs to getters.rs, because I expect it will be possible to generate multiple getters in the future.
  • Adapted the code to 1.59 MSRV (replaced let-else with an explicit let-match).
  • Added a sentence to the getter's doc that it can only be called when the value was set.
  • Changed the output order of methods to make getters are grouped together with the setters for the same member (this makes the rustdoc output better I think)
  • Added Getters page to the Typestate API guide section
  • Improved the #[builder(getter)] reference page. Added examples of how it works for optional members. Removed some redundancies and copy-paste mistakes.
  • Synchronized the sentence that describes the attribute (the first sentence in the reference page) with the table index in builder.md
  • Bumped the rust toolchain to 1.83. There is generally no problems with bumping it, because we also run tests on nightly and they are almost always green there. The only breakage from the version update may happen in trybuild tests, which would only require updating the trybuild test snapshots with TRYBUILD=overwrite cargo t --all-features
  • Some other cosmetic improvements

@Veetaha Veetaha merged commit 32b0d98 into master Dec 1, 2024
27 checks passed
@Veetaha Veetaha deleted the feat/getters-veetaha-amendments branch December 1, 2024 21:31
@github-actions github-actions bot mentioned this pull request Dec 1, 2024
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