File tree 1 file changed +2
-4
lines changed
1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,7 @@ impl Err {
35
35
R : fmt:: Debug + Send + Sync + ' static ,
36
36
{
37
37
let boxed = Box :: new ( ReasonContainer :: < R > :: new ( reason) ) ;
38
- let ptr: ptr:: NonNull < ReasonContainer > =
39
- unsafe { ptr:: NonNull :: new_unchecked ( Box :: into_raw ( boxed) ) . cast :: < ReasonContainer > ( ) } ;
38
+ let ptr = ptr:: NonNull :: from ( Box :: leak ( boxed) ) . cast :: < ReasonContainer > ( ) ;
40
39
Self {
41
40
reason_container : ptr,
42
41
source : None ,
@@ -65,8 +64,7 @@ impl Err {
65
64
E : error:: Error + Send + Sync + ' static ,
66
65
{
67
66
let boxed = Box :: new ( ReasonContainer :: < R > :: new ( reason) ) ;
68
- let ptr: ptr:: NonNull < ReasonContainer > =
69
- unsafe { ptr:: NonNull :: new_unchecked ( Box :: into_raw ( boxed) ) . cast :: < ReasonContainer > ( ) } ;
67
+ let ptr = ptr:: NonNull :: from ( Box :: leak ( boxed) ) . cast :: < ReasonContainer > ( ) ;
70
68
Self {
71
69
reason_container : ptr,
72
70
source : Some ( Box :: new ( source) ) ,
You can’t perform that action at this time.
0 commit comments