mirror of
https://github.com/openharmony/third_party_rust_ryu.git
synced 2026-07-20 03:23:32 -04:00
Skip init on clone
The cloned buffer's content is not observable until written into, so there is no need to keep it identical to the old buffer's content.
This commit is contained in:
+9
-1
@@ -21,7 +21,6 @@ const NEG_INFINITY: &'static str = "-inf";
|
||||
/// let printed = buffer.format_finite(1.234);
|
||||
/// assert_eq!(printed, "1.234");
|
||||
/// ```
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Buffer {
|
||||
#[cfg(maybe_uninit)]
|
||||
bytes: [MaybeUninit<u8>; 24],
|
||||
@@ -93,6 +92,15 @@ impl Buffer {
|
||||
}
|
||||
}
|
||||
|
||||
impl Copy for Buffer {}
|
||||
|
||||
impl Clone for Buffer {
|
||||
#[inline]
|
||||
fn clone(&self) -> Self {
|
||||
Buffer::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Buffer {
|
||||
#[inline]
|
||||
#[cfg_attr(feature = "no-panic", no_panic)]
|
||||
|
||||
Reference in New Issue
Block a user