From 0715c33cef95a16b4f06391855fc5004a2b97525 Mon Sep 17 00:00:00 2001 From: Kornel Date: Sun, 19 May 2024 23:44:51 +0100 Subject: [PATCH] Reduce Error size with Box --- src/error.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/error.rs b/src/error.rs index 6f1c4d4c78..54383b37bd 100644 --- a/src/error.rs +++ b/src/error.rs @@ -12,7 +12,7 @@ use crate::{raw, ErrorClass, ErrorCode}; pub struct Error { code: c_int, klass: c_int, - message: String, + message: Box, } impl Error { @@ -70,7 +70,7 @@ impl Error { unsafe fn from_raw(code: c_int, ptr: *const raw::git_error) -> Error { let message = CStr::from_ptr((*ptr).message as *const _).to_bytes(); - let message = String::from_utf8_lossy(message).into_owned(); + let message = String::from_utf8_lossy(message).into_owned().into(); Error { code, klass: (*ptr).klass, @@ -86,7 +86,7 @@ impl Error { Error { code: raw::GIT_ERROR as c_int, klass: raw::GIT_ERROR_NONE as c_int, - message: s.to_string(), + message: s.into(), } }