mirror of https://github.com/helix-editor/helix
parent
c74fec4c6e
commit
616758ee81
|
@ -1,10 +1,10 @@
|
||||||
/// Concatenates strings together.
|
/// Concatenates strings together.
|
||||||
///
|
///
|
||||||
/// `concat!(a, " ", b, " ", c)` is:
|
/// `str_concat!(a, " ", b, " ", c)` is:
|
||||||
/// - more performant than `format!("{a} {b} {c}")`
|
/// - more performant than `format!("{a} {b} {c}")`
|
||||||
/// - more ergonomic than using `String::with_capacity` followed by a series of `String::push_str`
|
/// - more ergonomic than using `String::with_capacity` followed by a series of `String::push_str`
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! concat {
|
macro_rules! str_concat {
|
||||||
($($value:expr),*) => {{
|
($($value:expr),*) => {{
|
||||||
// Rust does not allow using `+` as separator between value
|
// Rust does not allow using `+` as separator between value
|
||||||
// so we must add that at the end of everything. The `0` is necessary
|
// so we must add that at the end of everything. The `0` is necessary
|
||||||
|
|
|
@ -71,5 +71,5 @@ pub fn format_relative_time(timestamp: i64, timezone_offset: i32) -> String {
|
||||||
"from now"
|
"from now"
|
||||||
};
|
};
|
||||||
|
|
||||||
crate::concat!(value, " ", unit, " ", label)
|
crate::str_concat!(value, " ", unit, " ", label)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue