Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Create and apply a pattern for #[must_use]

Open
#74 0 comments 0 reactions 0 assignees View on GitHub

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

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

documentation refactor

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bcgit/bc-rust

All issues in bcgit/bc-rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.