diff --git a/yazi-boot/src/actions/version.rs b/yazi-boot/src/actions/version.rs index 02d316e0..4af8a3b7 100644 --- a/yazi-boot/src/actions/version.rs +++ b/yazi-boot/src/actions/version.rs @@ -1,12 +1,14 @@ use super::Actions; impl Actions { - pub(super) fn version() -> String { - format!( - "{} ({} {})", + pub(super) fn version() -> &'static str { + concat!( env!("CARGO_PKG_VERSION"), + " (", env!("VERGEN_GIT_SHA"), - env!("VERGEN_BUILD_DATE") + " ", + env!("VERGEN_BUILD_DATE"), + ")" ) } } diff --git a/yazi-dds/src/body/hey.rs b/yazi-dds/src/body/hey.rs index fa1de98b..961b4db7 100644 --- a/yazi-dds/src/body/hey.rs +++ b/yazi-dds/src/body/hey.rs @@ -15,7 +15,7 @@ pub struct BodyHey { impl BodyHey { #[inline] pub fn owned(peers: HashMap) -> Body<'static> { - Self { peers, version: BodyHi::version() }.into() + Self { peers, version: BodyHi::version().to_string() }.into() } } diff --git a/yazi-dds/src/body/hi.rs b/yazi-dds/src/body/hi.rs index ff38b753..d8dec663 100644 --- a/yazi-dds/src/body/hi.rs +++ b/yazi-dds/src/body/hi.rs @@ -18,13 +18,15 @@ impl<'a> BodyHi<'a> { pub fn borrowed(abilities: HashSet<&'a str>) -> Body<'a> { Self { abilities: abilities.into_iter().map(Cow::Borrowed).collect(), - version: Self::version(), + version: Self::version().to_string(), } .into() } #[inline] - pub fn version() -> String { format!("{} {}", env!("CARGO_PKG_VERSION"), env!("VERGEN_GIT_SHA")) } + pub fn version() -> &'static str { + concat!(env!("CARGO_PKG_VERSION"), " ", env!("VERGEN_GIT_SHA")) + } } impl<'a> From> for Body<'a> { diff --git a/yazi-dds/src/client.rs b/yazi-dds/src/client.rs index a2bc4950..a03a46b1 100644 --- a/yazi-dds/src/client.rs +++ b/yazi-dds/src/client.rs @@ -92,7 +92,7 @@ impl Client { } } - if version != Some(BodyHi::version()) { + if version.as_deref() != Some(BodyHi::version()) { bail!( "Incompatible version (Ya {}, Yazi {})", BodyHi::version(),