Skip to content

Commit 949aa49

Browse files
authored
Merge pull request #1053 from kornelski/smallerr
Reduce Error size with Box<str>
2 parents c3454fe + 0715c33 commit 949aa49

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/error.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{raw, ErrorClass, ErrorCode};
1212
pub struct Error {
1313
code: c_int,
1414
klass: c_int,
15-
message: String,
15+
message: Box<str>,
1616
}
1717

1818
impl Error {
@@ -70,7 +70,7 @@ impl Error {
7070

7171
unsafe fn from_raw(code: c_int, ptr: *const raw::git_error) -> Error {
7272
let message = CStr::from_ptr((*ptr).message as *const _).to_bytes();
73-
let message = String::from_utf8_lossy(message).into_owned();
73+
let message = String::from_utf8_lossy(message).into_owned().into();
7474
Error {
7575
code,
7676
klass: (*ptr).klass,
@@ -86,7 +86,7 @@ impl Error {
8686
Error {
8787
code: raw::GIT_ERROR as c_int,
8888
klass: raw::GIT_ERROR_NONE as c_int,
89-
message: s.to_string(),
89+
message: s.into(),
9090
}
9191
}
9292

0 commit comments

Comments
 (0)