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

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

#1390 in Rust patterns

Download history 301/week @ 2024-09-23 132/week @ 2024-09-30 8/week @ 2024-10-07 7/week @ 2024-10-14 73/week @ 2024-10-21 47/week @ 2024-10-28

138 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