fix: address correctness, safety, and concurrency issues (#2327)

Co-authored-by: heihutu <heihutu@gmail.com>
Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
houseme
2026-03-30 00:30:57 +08:00
committed by GitHub
parent 860a37d3a8
commit 7172e151de
90 changed files with 20397 additions and 1228 deletions
+1 -4
View File
@@ -28,10 +28,7 @@ static HELP_CACHE: OnceLock<Mutex<HashMap<String, &'static str>>> = OnceLock::ne
fn intern_string(cache: &OnceLock<Mutex<HashMap<String, &'static str>>>, value: &str) -> &'static str {
let cache = cache.get_or_init(Default::default);
let mut cache = match cache.lock() {
Ok(guard) => guard,
Err(poisoned) => poisoned.into_inner(),
};
let mut cache = cache.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
if let Some(existing) = cache.get(value) {
existing