Remove redundant allocations

This commit is contained in:
Hanno Braun 2022-11-03 10:41:16 +01:00
parent f0e80070b6
commit 7681c3415e
1 changed files with 6 additions and 6 deletions

View File

@ -108,13 +108,13 @@ impl Model {
let version_pkg: libloading::Symbol<fn() -> RawVersion> = let version_pkg: libloading::Symbol<fn() -> RawVersion> =
lib.get(b"version_pkg").map_err(Error::LoadingVersion)?; lib.get(b"version_pkg").map_err(Error::LoadingVersion)?;
let version_pkg = version_pkg(); let version_pkg = version_pkg().to_string();
if fj::version::VERSION_PKG != version_pkg.to_string() { if fj::version::VERSION_PKG != version_pkg {
let host = String::from_utf8_lossy( let host = String::from_utf8_lossy(
fj::version::VERSION_PKG.as_bytes(), fj::version::VERSION_PKG.as_bytes(),
) )
.into_owned(); .into_owned();
let model = version_pkg.to_string(); let model = version_pkg;
return Err(Error::VersionMismatch { host, model }); return Err(Error::VersionMismatch { host, model });
} }
@ -122,13 +122,13 @@ impl Model {
let version_full: libloading::Symbol<fn() -> RawVersion> = let version_full: libloading::Symbol<fn() -> RawVersion> =
lib.get(b"version_full").map_err(Error::LoadingVersion)?; lib.get(b"version_full").map_err(Error::LoadingVersion)?;
let version_full = version_full(); let version_full = version_full().to_string();
if fj::version::VERSION_FULL != version_full.to_string() { if fj::version::VERSION_FULL != version_full {
let host = String::from_utf8_lossy( let host = String::from_utf8_lossy(
fj::version::VERSION_FULL.as_bytes(), fj::version::VERSION_FULL.as_bytes(),
) )
.into_owned(); .into_owned();
let model = version_full.to_string(); let model = version_full;
warn!("{}", Error::VersionMismatch { host, model }); warn!("{}", Error::VersionMismatch { host, model });
} }