mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-24 05:52:07 +08:00
* perf(enhance): move tun mapping and alpn strings instead of cloning enforce_tun deep-cloned the tun mapping two lines before overwriting it; take_mapping now moves it instead (end state identical for absent, non-mapping and mapping values, including key order). builtin_hy_alpn cloned each hysteria node's alpn String only to dodge a borrow conflict while re-inserting under the same key; take it in place via get_mut + mem::take. The in-place guard preserves non-string alpn values that a remove-based shape would silently drop. Measured per enhance run on 200 hysteria nodes: hy_alpn 600 -> 200 allocations; enforce_tun 29 -> 3. * perf(tray): hoist tooltip version string update_tooltip re-derived the version string from CARGO_PKG_VERSION on every tray refresh; compute it once in a LazyLock. std::string::String is spelled out because bare String in this module resolves to the tristr alias. * refactor(cmd): take sidecar fallback as AsyncFnOnce(&str) finish_service_installation's FnOnce(String) -> FallbackFuture bound forced reason.clone() before the call. AsyncFnOnce(&str) borrows the reason and moves it into the Sidecar outcome - one allocation instead of two - and drops the FallbackFuture generic entirely. The windows-only call site's closure shape is verified with standalone rustc (edition 2024) repros; Windows CI compiles it definitively. * refactor(tray): store the tooltip version as a static str The only consumer reads the value as a str, so the String static allocated even when the version carries no build metadata. Return the env! literal directly in that case and leak the trimmed form otherwise; the LazyLock already owns the value for the process lifetime. * chore(enhance): drop comment on the alpn take