Skip to content

Commit 5dce719

Browse files
icefoxenSimonSapin
authored andcommitted
Vastly simplify TryFrom docs.
1 parent 60cf413 commit 5dce719

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

src/libcore/num/mod.rs

+8-28
Original file line numberDiff line numberDiff line change
@@ -4545,13 +4545,8 @@ macro_rules! try_from_unbounded {
45454545
type Error = TryFromIntError;
45464546

45474547
/// Try to create the target number type from a source
4548-
/// number type. If the source type has a larger range
4549-
/// than the target, or their ranges are disjoint (such
4550-
/// as converting a signed to unsigned number or vice
4551-
/// versa), this will return `None` if the source value
4552-
/// doesn't fit into the range of the destination value.
4553-
/// If the conversion can never fail, this is still
4554-
/// implemented for completeness's sake.
4548+
/// number type. This returns an error if the source value
4549+
/// is outside of the range of the target type.
45554550
#[inline]
45564551
fn try_from(value: $source) -> Result<Self, Self::Error> {
45574552
Ok(value as $target)
@@ -4568,13 +4563,8 @@ macro_rules! try_from_lower_bounded {
45684563
type Error = TryFromIntError;
45694564

45704565
/// Try to create the target number type from a source
4571-
/// number type. If the source type has a larger range
4572-
/// than the target, or their ranges are disjoint (such
4573-
/// as converting a signed to unsigned number or vice
4574-
/// versa), this will return `None` if the source value
4575-
/// doesn't fit into the range of the destination value.
4576-
/// If the conversion can never fail, this is still
4577-
/// implemented for completeness's sake.
4566+
/// number type. This returns an error if the source value
4567+
/// is outside of the range of the target type.
45784568
#[inline]
45794569
fn try_from(u: $source) -> Result<$target, TryFromIntError> {
45804570
if u >= 0 {
@@ -4595,13 +4585,8 @@ macro_rules! try_from_upper_bounded {
45954585
type Error = TryFromIntError;
45964586

45974587
/// Try to create the target number type from a source
4598-
/// number type. If the source type has a larger range
4599-
/// than the target, or their ranges are disjoint (such
4600-
/// as converting a signed to unsigned number or vice
4601-
/// versa), this will return `None` if the source value
4602-
/// doesn't fit into the range of the destination value.
4603-
/// If the conversion can never fail, this is still
4604-
/// implemented for completeness's sake.
4588+
/// number type. This returns an error if the source value
4589+
/// is outside of the range of the target type.
46054590
#[inline]
46064591
fn try_from(u: $source) -> Result<$target, TryFromIntError> {
46074592
if u > (<$target>::max_value() as $source) {
@@ -4622,13 +4607,8 @@ macro_rules! try_from_both_bounded {
46224607
type Error = TryFromIntError;
46234608

46244609
/// Try to create the target number type from a source
4625-
/// number type. If the source type has a larger range
4626-
/// than the target, or their ranges are disjoint (such
4627-
/// as converting a signed to unsigned number or vice
4628-
/// versa), this will return `None` if the source value
4629-
/// doesn't fit into the range of the destination value.
4630-
/// If the conversion can never fail, this is still
4631-
/// implemented for completeness's sake.
4610+
/// number type. This returns an error if the source value
4611+
/// is outside of the range of the target type.
46324612
#[inline]
46334613
fn try_from(u: $source) -> Result<$target, TryFromIntError> {
46344614
let min = <$target>::min_value() as $source;

0 commit comments

Comments
 (0)