Coverage Report

Created: 2024-10-16 07:58

/rust/registry/src/index.crates.io-6f17d22bba15001f/cranelift-codegen-0.91.1/src/dbg.rs
Line
Count
Source (jump to first uncovered line)
1
//! Debug tracing helpers.
2
use core::fmt;
3
4
/// Prefix added to the log file names, just before the thread name or id.
5
pub static LOG_FILENAME_PREFIX: &str = "cranelift.dbg.";
6
7
/// Helper for printing lists.
8
pub struct DisplayList<'a, T>(pub &'a [T])
9
where
10
    T: 'a + fmt::Display;
11
12
impl<'a, T> fmt::Display for DisplayList<'a, T>
13
where
14
    T: 'a + fmt::Display,
15
{
16
0
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
17
0
        match self.0.split_first() {
18
0
            None => write!(f, "[]"),
19
0
            Some((first, rest)) => {
20
0
                write!(f, "[{}", first)?;
21
0
                for x in rest {
22
0
                    write!(f, ", {}", x)?;
23
                }
24
0
                write!(f, "]")
25
            }
26
        }
27
0
    }
28
}