From 955dfaa6180ccfa53778ee4c65a7380fe4c43401 Mon Sep 17 00:00:00 2001 From: Trevor Spiteri Date: Thu, 21 Feb 2019 19:07:54 +0100 Subject: [PATCH] reword debug mode -> when debug assertions are enabled --- src/macros_from_to.rs | 40 +++++++++++++++++++++------------------- src/macros_round.rs | 24 ++++++++++++------------ src/sealed.rs | 19 +++++++++++-------- 3 files changed, 44 insertions(+), 39 deletions(-) diff --git a/src/macros_from_to.rs b/src/macros_from_to.rs index aa7bef6..d5a5aa9 100644 --- a/src/macros_from_to.rs +++ b/src/macros_from_to.rs @@ -63,9 +63,10 @@ Any extra fractional bits are truncated. # Panics -In debug mode, panics if the value does not fit. In release mode the -value is wrapped, but it is not considered a breaking change if in the -future it panics; if wrapping is required use [`wrapping_from_fixed`] +When debug assertions are enabled, panics if the value does not fit. +When debug assertions are not enabled, the wrapped value can be +returned, but it is not considered a breaking change if in the future +it panics; if wrapping is required use [`wrapping_from_fixed`] instead. # Examples @@ -104,10 +105,10 @@ Any extra fractional bits are truncated. # Panics -In debug mode, panics if the value does not fit. In release mode the -value is wrapped, but it is not considered a breaking change if in the -future it panics; if wrapping is required use [`wrapping_to_fixed`] -instead. +When debug assertions are enabled, panics if the value does not fit. +When debug assertions are not enabled, the wrapped value can be +returned, but it is not considered a breaking change if in the future +it panics; if wrapping is required use [`wrapping_to_fixed`] instead. # Examples @@ -145,10 +146,10 @@ The integer can be of type [`i8`], [`i16`], [`i32`], [`i64`], # Panics -In debug mode, panics if the value does not fit. In release mode the -value is wrapped, but it is not considered a breaking change if in the -future it panics; if wrapping is required use [`wrapping_from_int`] -instead. +When debug assertions are enabled, panics if the value does not fit. +When debug assertions are not enabled, the wrapped value can be +returned, but it is not considered a breaking change if in the future +it panics; if wrapping is required use [`wrapping_from_int`] instead. # Examples @@ -200,10 +201,10 @@ Any fractional bits are truncated. # Panics -In debug mode, panics if the value does not fit. In release mode the -value is wrapped, but it is not considered a breaking change if in the -future it panics; if wrapping is required use [`wrapping_to_int`] -instead. +When debug assertions are enabled, panics if the value does not fit. +When debug assertions are not enabled, the wrapped value can be +returned, but it is not considered a breaking change if in the future +it panics; if wrapping is required use [`wrapping_to_int`] instead. # Examples @@ -259,10 +260,11 @@ This method rounds to the nearest, with ties rounding to even. Panics if the value is not [finite]. -In debug mode, also panics if the value does not fit. In release mode -the value is wrapped, but it is not considered a breaking change if in -the future it panics; if wrapping is required use -[`wrapping_from_float`] instead. +When debug assertions are enabled, panics if the value does not fit. +When debug assertions are not enabled, the wrapped value can be +returned, but it is not considered a breaking change if in the future +it panics; if wrapping is required use [`wrapping_from_float`] +instead. # Examples diff --git a/src/macros_round.rs b/src/macros_round.rs index 871cd87..2f2a2c2 100644 --- a/src/macros_round.rs +++ b/src/macros_round.rs @@ -112,10 +112,10 @@ assert_eq!((-two_and_quarter).frac(), three_quarters); # Panics -In debug mode, panics if the result does not fit. In release mode the -result is wrapped, but it is not considered a breaking change if in -the future it panics; if wrapping is required use [`wrapping_ceil`] -instead. +When debug assertions are enabled, panics if the result does not fit. +When debug assertions are not enabled, the wrapped result can be +returned, but it is not considered a breaking change if in the future +it panics; if wrapping is required use [`wrapping_ceil`] instead. # Examples @@ -152,10 +152,10 @@ assert_eq!(two_half.ceil(), Fix::from_int(3)); $Signedness, "# Panics -In debug mode, panics if the result does not fit. In release mode the -result is wrapped, but it is not considered a breaking change if in -the future it panics; if wrapping is required use [`wrapping_floor`] -instead. +When debug assertions are enabled, panics if the result does not fit. +When debug assertions are not enabled, the wrapped result can be +returned, but it is not considered a breaking change if in the future +it panics; if wrapping is required use [`wrapping_floor`] instead. Overflow can only occur when there are zero integer bits. @@ -194,10 +194,10 @@ from zero. # Panics -In debug mode, panics if the result does not fit. In release mode the -result is wrapped, but it is not considered a breaking change if in -the future it panics; if wrapping is required use [`wrapping_round`] -instead. +When debug assertions are enabled, panics if the result does not fit. +When debug assertions are not enabled, the wrapped result can be +returned, but it is not considered a breaking change if in the future +it panics; if wrapping is required use [`wrapping_round`] instead. # Examples diff --git a/src/sealed.rs b/src/sealed.rs index 24d4d39..73d63bd 100644 --- a/src/sealed.rs +++ b/src/sealed.rs @@ -51,8 +51,9 @@ pub trait Int: SealedInt { /// /// # Panics /// - /// In debug mode, panics if the value does not fit. In release - /// mode the value is wrapped, but it is not considered a breaking + /// When debug assertions are enabled, panics if the value does + /// not fit. When debug assertions are not enabled, the wrapped + /// value can be returned, but it is not considered a breaking /// change if in the future it panics; if wrapping is required use /// [`wrapping_from_fixed`] instead. /// @@ -81,8 +82,9 @@ pub trait Int: SealedInt { /// /// # Panics /// - /// In debug mode, panics if the value does not fit. In release - /// mode the value is wrapped, but it is not considered a breaking + /// When debug assertions are enabled, panics if the value does + /// not fit. When debug assertions are not enabled, the wrapped + /// value can be returned, but it is not considered a breaking /// change if in the future it panics; if wrapping is required use /// [`wrapping_to_fixed`] instead. /// @@ -340,10 +342,11 @@ pub trait Float: SealedFloat { /// /// Panics if the value is not [finite]. /// - /// In debug mode, also panics if the value does not fit. In release mode - /// the value is wrapped, but it is not considered a breaking change if in - /// the future it panics; if wrapping is required use - /// [`wrapping_to_fixed`] instead. + /// When debug assertions are enabled, also panics if the value + /// does not fit. When debug assertions are not enabled, the + /// wrapped value can be returned, but it is not considered a + /// breaking change if in the future it panics; if wrapping is + /// required use [`wrapping_to_fixed`] instead. /// /// # Examples ///