File tree Expand file tree Collapse file tree 2 files changed +3
-12
lines changed Expand file tree Collapse file tree 2 files changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ rand = "0.5"
13
13
quickcheck = " 0.7"
14
14
15
15
[patch .crates-io ]
16
- noisy_float = { git = " https://github.com/SergiusIW/noisy_float-rs.git" , rev = " de01a40ceb1443110fe0b53f93c5164934e5c126 " }
16
+ noisy_float = { git = " https://github.com/SergiusIW/noisy_float-rs.git" , rev = " c33a94803987475bbd205c9ff5a697af533f9a17 " }
Original file line number Diff line number Diff line change @@ -79,14 +79,7 @@ macro_rules! impl_maybenan_for_fxx {
79
79
}
80
80
81
81
fn try_as_not_nan( & self ) -> Option <& $Nxx> {
82
- if self . is_nan( ) {
83
- None
84
- } else {
85
- // This is safe because `$Nxx` is a thin `repr(C)` wrapper
86
- // around `$fxx`, and we have just checked that `self` is
87
- // not a NaN value.
88
- Some ( unsafe { & * ( self as * const $fxx as * const $Nxx) } )
89
- }
82
+ $Nxx:: try_borrowed( self )
90
83
}
91
84
92
85
fn from_not_nan( value: $Nxx) -> $fxx {
@@ -103,9 +96,7 @@ macro_rules! impl_maybenan_for_fxx {
103
96
fn from_not_nan_ref_opt( value: Option <& $Nxx>) -> & $fxx {
104
97
match value {
105
98
None => & :: std:: $fxx:: NAN ,
106
- // This is safe because `$Nxx` is a thin `repr(C)` wrapper
107
- // around `$fxx`.
108
- Some ( num) => unsafe { & * ( num as * const $Nxx as * const $fxx) } ,
99
+ Some ( num) => num. as_ref( ) ,
109
100
}
110
101
}
111
102
You can’t perform that action at this time.
0 commit comments