Implementing a two line Display

โš“ Rust    ๐Ÿ“… 2025-10-05    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 7      

surdeus

Hey folks,

This is driving me absolutely nuts. This of course doesnโ€™t compile:

impl Display for TestResult {
    fn fmt(&self, f: &mut Formatter<'\_>) -> std::fmt::Result {
        writeln!(f, "{}", self.main_line())

        if let Some(detail_line) = self.detail_line() {
            writeln!(f, "{}", detail_line)
        }
    }
}

How would I do this properly?

Thanks!

10 posts - 5 participants

Read full topic

๐Ÿท๏ธ Rust_feed