@@ -71,23 +71,21 @@ unsafe impl GlobalAlloc for System {
71
71
c:: HeapFree ( c:: GetProcessHeap ( ) , 0 , header. 0 as c:: LPVOID )
72
72
}
73
73
} ;
74
- debug_assert ! ( err != 0 , "Failed to free heap memory: {}" , c:: GetLastError ( ) ) ;
74
+ debug_assert ! ( err != 0 , "Failed to free heap memory: {}" , unsafe { c:: GetLastError ( ) } ) ;
75
75
}
76
76
77
77
#[ inline]
78
78
unsafe fn realloc ( & self , ptr : * mut u8 , layout : Layout , new_size : usize ) -> * mut u8 {
79
- unsafe {
80
- if layout. align ( ) <= MIN_ALIGN {
81
- // SAFETY: HeapReAlloc is safe if ptr was allocated by this allocator
82
- // and new_size is not 0.
83
- unsafe {
84
- c:: HeapReAlloc ( c:: GetProcessHeap ( ) , 0 , ptr as c:: LPVOID , new_size) as * mut u8
85
- }
86
- } else {
87
- // SAFETY: The safety contract for `realloc_fallback` must be upheld by the caller
88
- unsafe {
89
- realloc_fallback ( self , ptr, layout, new_size)
90
- }
79
+ if layout. align ( ) <= MIN_ALIGN {
80
+ // SAFETY: HeapReAlloc is safe if ptr was allocated by this allocator
81
+ // and new_size is not 0.
82
+ unsafe {
83
+ c:: HeapReAlloc ( c:: GetProcessHeap ( ) , 0 , ptr as c:: LPVOID , new_size) as * mut u8
84
+ }
85
+ } else {
86
+ // SAFETY: The safety contract for `realloc_fallback` must be upheld by the caller
87
+ unsafe {
88
+ realloc_fallback ( self , ptr, layout, new_size)
91
89
}
92
90
}
93
91
}
0 commit comments