Skip to content

Commit 0048e76

Browse files
committed
Decrease size of ErrorCode from 32 bytes to 24 bytes
1 parent 561b0db commit 0048e76

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ struct ErrorImpl {
190190
#[derive(Debug)]
191191
pub enum ErrorCode {
192192
/// Catchall for syntax error messages
193-
Message(String),
193+
Message(Box<str>),
194194

195195
/// Some IO error occurred while serializing or deserializing.
196196
Io(io::Error),
@@ -388,7 +388,7 @@ impl de::Error for Error {
388388
Error {
389389
err: Box::new(
390390
ErrorImpl {
391-
code: ErrorCode::Message(msg.to_string()),
391+
code: ErrorCode::Message(msg.to_string().into_boxed_str()),
392392
line: 0,
393393
column: 0,
394394
},
@@ -410,7 +410,7 @@ impl ser::Error for Error {
410410
Error {
411411
err: Box::new(
412412
ErrorImpl {
413-
code: ErrorCode::Message(msg.to_string()),
413+
code: ErrorCode::Message(msg.to_string().into_boxed_str()),
414414
line: 0,
415415
column: 0,
416416
},

0 commit comments

Comments
 (0)