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

kix

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

4 releases (breaking)

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

#2 in #unwrap

Download history 301/week @ 2024-09-23 132/week @ 2024-09-30 8/week @ 2024-10-07

441 downloads per month

Apache-2.0

5KB
74 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