We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bbf077f commit 29b3410Copy full SHA for 29b3410
1 file changed
src/lib.rs
@@ -55,7 +55,6 @@ mod u128_ext;
55
56
use core::hint;
57
use core::mem::{self, MaybeUninit};
58
-use core::ptr;
59
use core::str;
60
#[cfg(feature = "no-panic")]
61
use no_panic::no_panic;
@@ -105,9 +104,8 @@ impl Buffer {
105
104
/// representation within the buffer.
106
#[cfg_attr(feature = "no-panic", no_panic)]
107
pub fn format<I: Integer>(&mut self, i: I) -> &str {
108
- let string = i.write(unsafe {
109
- &mut *ptr::addr_of_mut!(self.bytes).cast::<<I as private::Sealed>::Buffer>()
110
- });
+ let buf_ptr = self.bytes.as_mut_ptr().cast();
+ let string = i.write(unsafe { &mut *buf_ptr });
111
if string.len() > I::MAX_STR_LEN {
112
unsafe { hint::unreachable_unchecked() };
113
}
0 commit comments