github
71 of 151 new or added lines in 4 files covered. (47.02%)
6 existing lines in 1 file now uncovered.184 of 319 relevant lines covered (57.68%)
6.12 hits per line
1 |
#[allow(dead_code)]
|
|
2 |
pub(crate) trait Verboser { |
|
3 |
fn print(&self, _message: String); |
|
4 |
fn eprint(&self, _message: String); |
|
5 |
} |
|
6 |
|
|
7 |
struct DefaultVerboser {
|
|
8 |
} |
|
9 |
|
|
10 |
struct NullVerboser {
|
|
11 |
} |
|
12 |
|
|
13 |
impl Verboser for DefaultVerboser {
|
|
NEW
|
fn print(&self, message: String) { |
× |
NEW
|
println!("{}", message);
|
× |
NEW
|
} |
× |
17 |
|
|
NEW
|
fn eprint(&self, message: String) { |
× |
NEW
|
eprintln!("{}", message);
|
× |
NEW
|
} |
× |
21 |
} |
|
22 |
|
|
23 |
impl Verboser for NullVerboser {
|
|
NEW
|
fn print(&self, _message: String) { |
× |
NEW
|
// do nothing.
|
× |
NEW
|
} |
× |
27 |
|
|
NEW
|
fn eprint(&self, _message: String) { |
× |
NEW
|
// do nothing.
|
× |
NEW
|
} |
× |
31 |
} |
|
32 |
|
|
NEW
|
pub(crate) fn create(verbose: bool) -> Box<dyn Verboser> {
|
× |
NEW
|
if verbose {
|
× |
NEW
|
Box::new(DefaultVerboser {})
|
× |
36 |
} else {
|
|
NEW
|
Box::new(NullVerboser {})
|
× |
38 |
} |
|
NEW
|
} |
× |