Coverage Report

Created: 2025-12-20 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/time-0.3.44/src/hint.rs
Line
Count
Source
1
//! Hints to the compiler that affects how code should be emitted or optimized.
2
3
/// Indicate that a given branch is **not** likely to be taken, relatively speaking.
4
#[inline(always)]
5
#[cold]
6
26.8k
pub(crate) const fn cold_path() {}
7
8
/// Indicate that a given condition is likely to be true.
9
#[inline(always)]
10
39.3k
pub(crate) const fn likely(b: bool) -> bool {
11
39.3k
    if !b {
12
18.7k
        cold_path();
13
20.6k
    }
14
39.3k
    b
15
39.3k
}
16
17
/// Indicate that a given condition is likely to be false.
18
#[inline(always)]
19
50.5k
pub(crate) const fn unlikely(b: bool) -> bool {
20
50.5k
    if b {
21
7.11k
        cold_path();
22
43.4k
    }
23
50.5k
    b
24
50.5k
}