From d0e0686a5f7656dd3ef5decad606ed65976ec825 Mon Sep 17 00:00:00 2001 From: Choongwoo Han Date: Tue, 20 Dec 2022 18:30:37 -0800 Subject: [PATCH] Use expect --- boa_profiler/src/lib.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/boa_profiler/src/lib.rs b/boa_profiler/src/lib.rs index 46081fe5973..3e1530d3112 100644 --- a/boa_profiler/src/lib.rs +++ b/boa_profiler/src/lib.rs @@ -24,7 +24,7 @@ //! [boa-web]: https://boa-dev.github.io/ //! [boa-playground]: https://boa-dev.github.io/boa/playground/ -#![cfg_attr(not(any(test, feature = "profiler")), forbid(clippy::unwrap_used))] +#![cfg_attr(not(test), forbid(clippy::unwrap_used))] #![warn(missing_docs, clippy::dbg_macro)] #![deny( // rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html @@ -122,12 +122,18 @@ impl Profiler { fn get_or_alloc_string(&self, s: &str) -> StringId { { // Check the cache only with the read lock first. - let cache = self.string_cache.read().unwrap(); + let cache = self + .string_cache + .read() + .expect("Some writer panicked while holding an exclusive lock."); if let Some(id) = cache.get(s) { return *id; } } - let mut cache = self.string_cache.write().unwrap(); + let mut cache = self + .string_cache + .write() + .expect("Some writer panicked while holding an exclusive lock."); let entry = cache.entry(s.into()); match entry { Entry::Occupied(entry) => *entry.get(),