#testing #error #clippy #unwrap #enforce #eliminate #component

kix

A result type for testing that supports to eliminate using of Result::unwrap

5 releases (3 breaking)

0.4.1 Oct 27, 2024
0.4.0 Oct 1, 2024
0.3.0 Sep 28, 2024
0.2.0 Sep 27, 2024
0.1.0 Sep 27, 2024

#3 in #unwrap

Download history 304/week @ 2024-09-24 131/week @ 2024-10-01 7/week @ 2024-10-08 6/week @ 2024-10-15 96/week @ 2024-10-22 27/week @ 2024-10-29 9/week @ 2024-11-05

139 downloads per month
Used in 2 crates

Apache-2.0

6KB
75 lines

kix

A result type for testing that supports to eliminate using of Result::unwrap. So a library may enforce flags such as -D clippy::unwrap_used without hassle.

Quickstart

For a quickstart, see examples. For installation from package repository, see crates.io. For API references, see doc.rs.

Test

# Just install for the first time.
rustup component add clippy

cargo test
cargo clippy

lib.rs:

A result type for testing that supports to eliminate using of Result::unwrap. So a library may enforce flags such as -D clippy::unwrap_used without hassle.

Set environment RUST_BACKTRACE=1 to enable backtrace. The first backtrace's frame does not point to the error's location accuracy. Sometimes, the third or fourth does. This issue may be solved once Backtrace::frames is stable.

Do not use [Result] for anything other than testing. Because it depends on [Error] that does not implement std::error::Error. This is not a choice. There is no way to implemnt std::error::Error and From<dyn std::error::Error> at the same time. If there is a need of using [Error] as std::error::Error, then Error::as_std_error may help.

No runtime deps