Coverage Report

Created: 2025-09-27 07:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/hashbrown-0.16.0/src/scopeguard.rs
Line
Count
Source
1
// Extracted from the scopeguard crate
2
use core::{
3
    mem::ManuallyDrop,
4
    ops::{Deref, DerefMut},
5
    ptr,
6
};
7
8
pub struct ScopeGuard<T, F>
9
where
10
    F: FnMut(&mut T),
11
{
12
    dropfn: F,
13
    value: T,
14
}
15
16
#[inline]
17
159k
pub fn guard<T, F>(value: T, dropfn: F) -> ScopeGuard<T, F>
18
159k
where
19
159k
    F: FnMut(&mut T),
20
{
21
159k
    ScopeGuard { dropfn, value }
22
159k
}
hashbrown::scopeguard::guard::<hashbrown::raw::RawTableInner, <hashbrown::raw::RawTableInner>::prepare_resize<hashbrown::raw::alloc::inner::Global>::{closure#0}>
Line
Count
Source
17
67.2k
pub fn guard<T, F>(value: T, dropfn: F) -> ScopeGuard<T, F>
18
67.2k
where
19
67.2k
    F: FnMut(&mut T),
20
{
21
67.2k
    ScopeGuard { dropfn, value }
22
67.2k
}
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(naga::ir::SwitchValue, ())>, <hashbrown::raw::RawTable<(naga::ir::SwitchValue, ())>>::clear::{closure#0}>
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(naga::ir::ResourceBinding, ())>, <hashbrown::raw::RawTable<(naga::ir::ResourceBinding, ())>>::clear::{closure#0}>
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(alloc::string::String, naga::arena::handle::Handle<naga::ir::Type>)>, <hashbrown::raw::RawTable<(alloc::string::String, naga::arena::handle::Handle<naga::ir::Type>)>>::clear::{closure#0}>
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(alloc::string::String, naga::front::glsl::ast::VariableReference)>, <hashbrown::raw::RawTable<(alloc::string::String, naga::front::glsl::ast::VariableReference)>>::clear::{closure#0}>
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(alloc::string::String, naga::front::glsl::ast::FunctionDeclaration)>, <hashbrown::raw::RawTable<(alloc::string::String, naga::front::glsl::ast::FunctionDeclaration)>>::clear::{closure#0}>
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(alloc::string::String, u32)>, <hashbrown::raw::RawTable<(alloc::string::String, u32)>>::clear::{closure#0}>
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(alloc::string::String, ())>, <hashbrown::raw::RawTable<(alloc::string::String, ())>>::clear::{closure#0}>
hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(&str, naga::arena::handle::Handle<naga::front::wgsl::parse::ast::Local>)>, <hashbrown::raw::RawTable<(&str, naga::arena::handle::Handle<naga::front::wgsl::parse::ast::Local>)>>::clear::{closure#0}>
Line
Count
Source
17
84.0k
pub fn guard<T, F>(value: T, dropfn: F) -> ScopeGuard<T, F>
18
84.0k
where
19
84.0k
    F: FnMut(&mut T),
20
{
21
84.0k
    ScopeGuard { dropfn, value }
22
84.0k
}
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<((u32, u32), naga::front::spv::Decoration)>, <hashbrown::raw::RawTable<((u32, u32), naga::front::spv::Decoration)>>::clear::{closure#0}>
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::Decoration)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::Decoration)>>::clear::{closure#0}>
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::LookupFunction)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::LookupFunction)>>::clear::{closure#0}>
hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::LookupExpression)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::LookupExpression)>>::clear::{closure#0}>
Line
Count
Source
17
8.51k
pub fn guard<T, F>(value: T, dropfn: F) -> ScopeGuard<T, F>
18
8.51k
where
19
8.51k
    F: FnMut(&mut T),
20
{
21
8.51k
    ScopeGuard { dropfn, value }
22
8.51k
}
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::LookupLoadOverride)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::LookupLoadOverride)>>::clear::{closure#0}>
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::image::LookupSampledImage)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::image::LookupSampledImage)>>::clear::{closure#0}>
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<(u16, ())>, <hashbrown::raw::RawTable<(u16, ())>>::clear::{closure#0}>
hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTable<usize>, <hashbrown::raw::RawTable<usize>>::clear::{closure#0}>
Line
Count
Source
17
4
pub fn guard<T, F>(value: T, dropfn: F) -> ScopeGuard<T, F>
18
4
where
19
4
    F: FnMut(&mut T),
20
{
21
4
    ScopeGuard { dropfn, value }
22
4
}
Unexecuted instantiation: hashbrown::scopeguard::guard::<&mut hashbrown::raw::RawTableInner, <hashbrown::raw::RawTableInner>::rehash_in_place::{closure#0}>
Unexecuted instantiation: hashbrown::scopeguard::guard::<_, _>
23
24
impl<T, F> ScopeGuard<T, F>
25
where
26
    F: FnMut(&mut T),
27
{
28
    #[inline]
29
0
    pub fn into_inner(guard: Self) -> T {
30
        // Cannot move out of Drop-implementing types, so
31
        // ptr::read the value out of a ManuallyDrop<Self>
32
        // Don't use mem::forget as that might invalidate value
33
0
        let guard = ManuallyDrop::new(guard);
34
        unsafe {
35
0
            let value = ptr::read(&guard.value);
36
            // read the closure so that it is dropped
37
0
            let _ = ptr::read(&guard.dropfn);
38
0
            value
39
        }
40
0
    }
41
}
42
43
impl<T, F> Deref for ScopeGuard<T, F>
44
where
45
    F: FnMut(&mut T),
46
{
47
    type Target = T;
48
    #[inline]
49
197k
    fn deref(&self) -> &T {
50
197k
        &self.value
51
197k
    }
<hashbrown::scopeguard::ScopeGuard<hashbrown::raw::RawTableInner, <hashbrown::raw::RawTableInner>::prepare_resize<hashbrown::raw::alloc::inner::Global>::{closure#0}> as core::ops::deref::Deref>::deref
Line
Count
Source
49
197k
    fn deref(&self) -> &T {
50
197k
        &self.value
51
197k
    }
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTableInner, <hashbrown::raw::RawTableInner>::rehash_in_place::{closure#0}> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<_, _> as core::ops::deref::Deref>::deref
52
}
53
54
impl<T, F> DerefMut for ScopeGuard<T, F>
55
where
56
    F: FnMut(&mut T),
57
{
58
    #[inline]
59
491k
    fn deref_mut(&mut self) -> &mut T {
60
491k
        &mut self.value
61
491k
    }
<hashbrown::scopeguard::ScopeGuard<hashbrown::raw::RawTableInner, <hashbrown::raw::RawTableInner>::prepare_resize<hashbrown::raw::alloc::inner::Global>::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
59
399k
    fn deref_mut(&mut self) -> &mut T {
60
399k
        &mut self.value
61
399k
    }
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(naga::ir::SwitchValue, ())>, <hashbrown::raw::RawTable<(naga::ir::SwitchValue, ())>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(naga::ir::ResourceBinding, ())>, <hashbrown::raw::RawTable<(naga::ir::ResourceBinding, ())>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(alloc::string::String, naga::arena::handle::Handle<naga::ir::Type>)>, <hashbrown::raw::RawTable<(alloc::string::String, naga::arena::handle::Handle<naga::ir::Type>)>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(alloc::string::String, naga::front::glsl::ast::VariableReference)>, <hashbrown::raw::RawTable<(alloc::string::String, naga::front::glsl::ast::VariableReference)>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(alloc::string::String, naga::front::glsl::ast::FunctionDeclaration)>, <hashbrown::raw::RawTable<(alloc::string::String, naga::front::glsl::ast::FunctionDeclaration)>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(alloc::string::String, u32)>, <hashbrown::raw::RawTable<(alloc::string::String, u32)>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(alloc::string::String, ())>, <hashbrown::raw::RawTable<(alloc::string::String, ())>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
<hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(&str, naga::arena::handle::Handle<naga::front::wgsl::parse::ast::Local>)>, <hashbrown::raw::RawTable<(&str, naga::arena::handle::Handle<naga::front::wgsl::parse::ast::Local>)>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
59
84.0k
    fn deref_mut(&mut self) -> &mut T {
60
84.0k
        &mut self.value
61
84.0k
    }
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<((u32, u32), naga::front::spv::Decoration)>, <hashbrown::raw::RawTable<((u32, u32), naga::front::spv::Decoration)>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::Decoration)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::Decoration)>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::LookupFunction)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::LookupFunction)>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
<hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::LookupExpression)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::LookupExpression)>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
59
8.51k
    fn deref_mut(&mut self) -> &mut T {
60
8.51k
        &mut self.value
61
8.51k
    }
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::LookupLoadOverride)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::LookupLoadOverride)>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::image::LookupSampledImage)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::image::LookupSampledImage)>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(u16, ())>, <hashbrown::raw::RawTable<(u16, ())>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
<hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<usize>, <hashbrown::raw::RawTable<usize>>::clear::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
59
4
    fn deref_mut(&mut self) -> &mut T {
60
4
        &mut self.value
61
4
    }
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTableInner, <hashbrown::raw::RawTableInner>::rehash_in_place::{closure#0}> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<_, _> as core::ops::deref::DerefMut>::deref_mut
62
}
63
64
impl<T, F> Drop for ScopeGuard<T, F>
65
where
66
    F: FnMut(&mut T),
67
{
68
    #[inline]
69
159k
    fn drop(&mut self) {
70
159k
        (self.dropfn)(&mut self.value);
71
159k
    }
<hashbrown::scopeguard::ScopeGuard<hashbrown::raw::RawTableInner, <hashbrown::raw::RawTableInner>::prepare_resize<hashbrown::raw::alloc::inner::Global>::{closure#0}> as core::ops::drop::Drop>::drop
Line
Count
Source
69
67.2k
    fn drop(&mut self) {
70
67.2k
        (self.dropfn)(&mut self.value);
71
67.2k
    }
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(naga::ir::SwitchValue, ())>, <hashbrown::raw::RawTable<(naga::ir::SwitchValue, ())>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(naga::ir::ResourceBinding, ())>, <hashbrown::raw::RawTable<(naga::ir::ResourceBinding, ())>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(alloc::string::String, naga::arena::handle::Handle<naga::ir::Type>)>, <hashbrown::raw::RawTable<(alloc::string::String, naga::arena::handle::Handle<naga::ir::Type>)>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(alloc::string::String, naga::front::glsl::ast::VariableReference)>, <hashbrown::raw::RawTable<(alloc::string::String, naga::front::glsl::ast::VariableReference)>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(alloc::string::String, naga::front::glsl::ast::FunctionDeclaration)>, <hashbrown::raw::RawTable<(alloc::string::String, naga::front::glsl::ast::FunctionDeclaration)>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(alloc::string::String, u32)>, <hashbrown::raw::RawTable<(alloc::string::String, u32)>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(alloc::string::String, ())>, <hashbrown::raw::RawTable<(alloc::string::String, ())>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
<hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(&str, naga::arena::handle::Handle<naga::front::wgsl::parse::ast::Local>)>, <hashbrown::raw::RawTable<(&str, naga::arena::handle::Handle<naga::front::wgsl::parse::ast::Local>)>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Line
Count
Source
69
84.0k
    fn drop(&mut self) {
70
84.0k
        (self.dropfn)(&mut self.value);
71
84.0k
    }
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<((u32, u32), naga::front::spv::Decoration)>, <hashbrown::raw::RawTable<((u32, u32), naga::front::spv::Decoration)>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::Decoration)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::Decoration)>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::LookupFunction)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::LookupFunction)>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
<hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::LookupExpression)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::LookupExpression)>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Line
Count
Source
69
8.51k
    fn drop(&mut self) {
70
8.51k
        (self.dropfn)(&mut self.value);
71
8.51k
    }
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::LookupLoadOverride)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::LookupLoadOverride)>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(u32, naga::front::spv::image::LookupSampledImage)>, <hashbrown::raw::RawTable<(u32, naga::front::spv::image::LookupSampledImage)>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<(u16, ())>, <hashbrown::raw::RawTable<(u16, ())>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
<hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTable<usize>, <hashbrown::raw::RawTable<usize>>::clear::{closure#0}> as core::ops::drop::Drop>::drop
Line
Count
Source
69
4
    fn drop(&mut self) {
70
4
        (self.dropfn)(&mut self.value);
71
4
    }
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<&mut hashbrown::raw::RawTableInner, <hashbrown::raw::RawTableInner>::rehash_in_place::{closure#0}> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <hashbrown::scopeguard::ScopeGuard<_, _> as core::ops::drop::Drop>::drop
72
}