mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
refactor: replace format! with concat! for string literals
This commit is contained in:
parent
b8b3ab9be3
commit
97c53bfa24
4 changed files with 12 additions and 8 deletions
|
|
@ -1,12 +1,14 @@
|
||||||
use super::Actions;
|
use super::Actions;
|
||||||
|
|
||||||
impl Actions {
|
impl Actions {
|
||||||
pub(super) fn version() -> String {
|
pub(super) fn version() -> &'static str {
|
||||||
format!(
|
concat!(
|
||||||
"{} ({} {})",
|
|
||||||
env!("CARGO_PKG_VERSION"),
|
env!("CARGO_PKG_VERSION"),
|
||||||
|
" (",
|
||||||
env!("VERGEN_GIT_SHA"),
|
env!("VERGEN_GIT_SHA"),
|
||||||
env!("VERGEN_BUILD_DATE")
|
" ",
|
||||||
|
env!("VERGEN_BUILD_DATE"),
|
||||||
|
")"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ pub struct BodyHey {
|
||||||
impl BodyHey {
|
impl BodyHey {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn owned(peers: HashMap<u64, Peer>) -> Body<'static> {
|
pub fn owned(peers: HashMap<u64, Peer>) -> Body<'static> {
|
||||||
Self { peers, version: BodyHi::version() }.into()
|
Self { peers, version: BodyHi::version().to_string() }.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,15 @@ impl<'a> BodyHi<'a> {
|
||||||
pub fn borrowed(abilities: HashSet<&'a str>) -> Body<'a> {
|
pub fn borrowed(abilities: HashSet<&'a str>) -> Body<'a> {
|
||||||
Self {
|
Self {
|
||||||
abilities: abilities.into_iter().map(Cow::Borrowed).collect(),
|
abilities: abilities.into_iter().map(Cow::Borrowed).collect(),
|
||||||
version: Self::version(),
|
version: Self::version().to_string(),
|
||||||
}
|
}
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[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<BodyHi<'a>> for Body<'a> {
|
impl<'a> From<BodyHi<'a>> for Body<'a> {
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ impl Client {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if version != Some(BodyHi::version()) {
|
if version.as_deref() != Some(BodyHi::version()) {
|
||||||
bail!(
|
bail!(
|
||||||
"Incompatible version (Ya {}, Yazi {})",
|
"Incompatible version (Ya {}, Yazi {})",
|
||||||
BodyHi::version(),
|
BodyHi::version(),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue