Create and apply a pattern for #[must_use]
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- cryptography, documentation
Research direction
Start by reading QUALITY_AND_STYLE.md and the public APIs of the bc-rust library. Review functions returning Result<(), Error> or Result<usize, Error> and identify where ignored results could cause bugs or vulnerabilities. Done means the #[must_use] guidance is documented in QUALITY_AND_STYLE.md and applied consistently across the library.
Written by the indexing model from the issue text.
Description
Summary
Rust Lang has an attribute #[must_use]
#[must_use]
fn use_me1() -> u8 { 0 }
#[must_use = "explanation of why it should be used"]
fn use_me2() -> u8 { 0 }
#[must_use]
fn f() {}
f(); // ERROR: Unused return value that must be used.
https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute
Scope
The scope of this ticket is to crawl over all public APIs of the bc-rust library and tag any where ignoring a return value could lead to bugs or vulnerabilities. This is probably particularly relevant on functions of the form -> Result<(), Error>, or -> Result<usize, Error>; it might not be necessary to handle the () or usize, but we should use #[must_use] to force the caller to check for an error.
We should come up with a guideline for when a function should be tagged, and document this in QUALITY_AND_STYLE.md.
Acceptance Criteria
- Usage guidance for
#[must_use]has been written in QUALITY_AND_STYLE.md. - This guidance has been applied consistently across the library.
- Dominant language
- Rust
- Stars
- 25
- Forks
- 18
- Avg merge
- 14d 10h
- Merged PRs (30d)
- 5
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bcgit/bc-rust
-
Improve docs in FactoriesPossibly taken @pollychen-lab claimed this 3 days ago. Opendocumentation good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
bcgit/bc-rust#161 · 1 reaction ·
Maintainers usually reply within 2 days
-
good first issue refactor
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
bcgit/bc-rust#163 · 2 comments ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 2 days
-
documentation good first issue refactor
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rust-windowing/winit#4731 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area:cli bug priority:high
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
component:sight
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agentic-os-org/ANOLISA#4622 · 1 comment ·
Maintainers usually reply within 1 day