From 25b429ca6d5fab54585b1583af395b478e1e2daa Mon Sep 17 00:00:00 2001 From: Petr Ermishkin Date: Tue, 16 Feb 2021 10:21:57 +0300 Subject: [PATCH] fix(codestyle): remove unnecesary `Result` wrap from test return value type --- CHANGELOG.md | 2 ++ examples/usage.rs | 10 +++++----- src/tests/fp128.rs | 4 +--- src/tests/fp64.rs | 4 +--- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6b9f94..6af679b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. `fixnum` adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Method `FixedPoint::into_bits` (@KalitaAlexey). ## [0.3.0] - 2021-01-25 ### Removed diff --git a/examples/usage.rs b/examples/usage.rs index 8b2b7d3..b0a55d9 100644 --- a/examples/usage.rs +++ b/examples/usage.rs @@ -1,18 +1,18 @@ use derive_more::From; use fixnum::{impl_op, typenum::U9, FixedPoint}; -type FP = FixedPoint; +type Fp = FixedPoint; #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, From)] struct Size(i32); #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, From)] -struct Price(FP); +struct Price(Fp); #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, From)] -struct PriceDelta(FP); +struct PriceDelta(Fp); #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, From)] -struct Amount(FP); +struct Amount(Fp); #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, From)] -struct Ratio(FP); +struct Ratio(Fp); impl_op!(Size [cadd] Size = Size); impl_op!(Size [csub] Size = Size); diff --git a/src/tests/fp128.rs b/src/tests/fp128.rs index 8ba573d..8a36773 100644 --- a/src/tests/fp128.rs +++ b/src/tests/fp128.rs @@ -327,13 +327,11 @@ fn rdiv_round() -> Result<()> { } #[test] -fn rdiv_division_by_zero() -> Result<()> { +fn rdiv_division_by_zero() { assert_eq!( FixedPoint::MAX.rdiv(FixedPoint::ZERO, Ceil), Err(ArithmeticError::DivisionByZero) ); - - Ok(()) } #[test] diff --git a/src/tests/fp64.rs b/src/tests/fp64.rs index 04d3dec..e6e3d0b 100644 --- a/src/tests/fp64.rs +++ b/src/tests/fp64.rs @@ -296,13 +296,11 @@ fn rdiv_round() -> Result<()> { } #[test] -fn rdiv_division_by_zero() -> Result<()> { +fn rdiv_division_by_zero() { assert_eq!( FixedPoint::MAX.rdiv(FixedPoint::ZERO, Ceil), Err(ArithmeticError::DivisionByZero) ); - - Ok(()) } #[test]