/home/runner/work/bare_err_tree/bare_err_tree/bare_err_tree/test_cases/std/src/bin/empty.rs
Line | Count | Source |
1 | | /* |
2 | | * This Source Code Form is subject to the terms of the Mozilla Public |
3 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | | * file, You can obtain one at https://mozilla.org/MPL/2.0/. |
5 | | */ |
6 | | |
7 | | use bare_err_tree::ErrTreeDisplay; |
8 | | use std::fmt::Write; |
9 | | use thiserror::Error; |
10 | | |
11 | | #[allow(dead_code)] |
12 | 0 | fn main() { |
13 | 0 | let formatted = gen_print(); |
14 | 0 | println!("{formatted}") |
15 | 0 | } |
16 | | |
17 | 1 | fn gen_print() -> String { |
18 | 1 | let fatal = Empty; |
19 | 1 | let mut formatted = String::new(); |
20 | 1 | write!( |
21 | 1 | formatted, |
22 | 1 | "{}", |
23 | 1 | ErrTreeDisplay::<_, 60>(&fatal as &dyn std::error::Error) |
24 | 1 | ) |
25 | 1 | .unwrap(); |
26 | 1 | formatted |
27 | 1 | } |
28 | | |
29 | | #[derive(Debug, Error)] |
30 | | #[error("EMPTY")] |
31 | | struct Empty; |