chore: clippy

This commit is contained in:
dundargoc 2024-02-06 23:18:27 +01:00 committed by Amaan Qureshi
parent a1870b6013
commit c8bd6705cf
No known key found for this signature in database
GPG key ID: E67890ADC4227273
36 changed files with 467 additions and 462 deletions

View file

@ -30,7 +30,7 @@ struct AllocationRecorder {
}
thread_local! {
static RECORDER: AllocationRecorder = Default::default();
static RECORDER: AllocationRecorder = AllocationRecorder::default();
}
extern "C" {
@ -60,12 +60,10 @@ pub fn record<T>(f: impl FnOnce() -> T) -> T {
.map(|e| e.1)
.collect::<Vec<_>>()
});
if !outstanding_allocation_indices.is_empty() {
panic!(
"Leaked allocation indices: {:?}",
outstanding_allocation_indices
);
}
assert!(
outstanding_allocation_indices.is_empty(),
"Leaked allocation indices: {outstanding_allocation_indices:?}"
);
value
}
@ -83,9 +81,7 @@ fn record_alloc(ptr: *mut c_void) {
}
fn record_dealloc(ptr: *mut c_void) {
if ptr.is_null() {
panic!("Zero pointer deallocation!");
}
assert!(!ptr.is_null(), "Zero pointer deallocation!");
RECORDER.with(|recorder| {
if recorder.enabled.load(SeqCst) {
recorder