Skip to content

Canonicalize all_equal_value's error #1032

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

phimuemue
Copy link
Member

Similar to exactly_one_error's error type, all_equal_value's error type now implements std::error::Error. (I saw the discrepancy because exactly_one_error works with anyhow, whereas all_equal_value does not.)

Since I had to introduce a new type anyways, I converted from (Item, Item) to [Item; 2]. I suggest we generally lean towards arrays instead of tuples if the components have the same type.

phimuemue added 2 commits June 2, 2025 20:26
* Similar to ExactlyOneError.
* Use [Item; 2] instead of (Item, Item), because they have the same type and arrays are friendler wrt iteration.
Copy link

codecov bot commented Jun 5, 2025

Codecov Report

Attention: Patch coverage is 40.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 93.80%. Comparing base (6814180) to head (84b2e56).
Report is 141 commits behind head on master.

Files with missing lines Patch % Lines
src/all_equal_value_err.rs 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1032      +/-   ##
==========================================
- Coverage   94.38%   93.80%   -0.59%     
==========================================
  Files          48       51       +3     
  Lines        6665     6202     -463     
==========================================
- Hits         6291     5818     -473     
- Misses        374      384      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@phimuemue
Copy link
Member Author

Checks fail because Display implementation is not covered, similar to the existing ExactlyOneError.

use std::error::Error;
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};

/// Value returned for the error case of `Itertools::all_equal_value()`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this an intradoc link:

Suggested change
/// Value returned for the error case of `Itertools::all_equal_value()`.
/// Value returned for the error case of [`Itertools::all_equal_value]`.

you might need to add a #[cfg(doc)] use crate::Itertools; to the top of the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants