rust-lang / rust-lang/rust-clippy

Changing `bool` to `Result<(), ()>` in function return type leads to clippy warnings

Open
#12,890 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-false-positive
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Summary

I often see functions returning a success/failure via a bool in Rust code bases. Changing that to Result<(), ()>, while IMO objectively better than bool, since the meaning of success/failure is clear, gets linted by clippy. This means that people are encouraged not to switch away from bool.

I do not have a suggestion on how to fix this problem.

Lint Name

result_unit_err

Contributor guide

Open the contributing guide

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.

Research direction

Review the result_unit_err lint and its current behavior first; the issue does not identify a source file or test. Done requires a maintainer-approved resolution for whether and how this lint should treat Result<(), ()> versus bool, plus coverage for that decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.