Skip to content

Commit bd877df

Browse files
committed
Fix no_std Bugs (#[serde(rename=int|bool)])
1 parent f1cd5a2 commit bd877df

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

serde/src/export.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ pub use lib::marker::PhantomData;
1414
pub use lib::option::Option::{self, None, Some};
1515
pub use lib::result::Result::{self, Ok, Err};
1616

17-
pub use self::string::from_utf8_lossy;
18-
pub use self::string::from_int;
19-
pub use self::string::from_bool;
17+
pub use self::string::{from_utf8_lossy, from_int, from_bool};
2018

2119
mod string {
2220
use lib::*;
@@ -55,9 +53,11 @@ mod string {
5553

5654
#[cfg(not(any(feature = "std", feature = "alloc")))]
5755
pub fn from_int(i: u64) -> [u8; 20] {
58-
let buf = [0; 20];
59-
let wrap = Wrapper { buf: &buf };
60-
write!(wrap, "{}", i);
56+
// len(str(1<<64)) = 20
57+
let mut buf = [0; 20];
58+
let wrap = Wrapper { buf: &mut buf };
59+
use fmt::Write;
60+
write!(wrap, "{}", i).ok();
6161
buf
6262
}
6363

0 commit comments

Comments
 (0)