Inline some stuff

This commit is contained in:
Filip Tibell 2024-01-31 20:24:14 +01:00
parent 013537b27b
commit a5d411e95c
No known key found for this signature in database

View file

@ -1,3 +1,5 @@
#![allow(clippy::inline_always)]
use std::{ use std::{
cell::RefCell, cell::RefCell,
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
@ -20,16 +22,19 @@ impl ThreadResultMap {
} }
} }
#[inline(always)]
pub fn track(&self, id: ThreadId) { pub fn track(&self, id: ThreadId) {
self.tracked.borrow_mut().insert(id); self.tracked.borrow_mut().insert(id);
} }
#[inline(always)]
pub fn is_tracked(&self, id: ThreadId) -> bool { pub fn is_tracked(&self, id: ThreadId) -> bool {
self.tracked.borrow().contains(&id) self.tracked.borrow().contains(&id)
} }
#[inline(always)]
pub fn insert(&self, id: ThreadId, result: ThreadResult) { pub fn insert(&self, id: ThreadId, result: ThreadResult) {
assert!(self.is_tracked(id), "Thread must be tracked"); debug_assert!(self.is_tracked(id), "Thread must be tracked");
self.inner.borrow_mut().insert(id, result); self.inner.borrow_mut().insert(id, result);
} }