1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
use crate::{Config, EmitMode};
use std::borrow::Cow;
pub(crate) fn transform_missing_snippet<'a>(config: &Config, string: &'a str) -> Cow<'a, str> {
match config.emit_mode() {
EmitMode::Coverage => Cow::from(replace_chars(string)),
_ => Cow::from(string),
}
}
fn replace_chars(s: &str) -> String {
s.chars()
.map(|ch| if ch.is_whitespace() { ch } else { 'X' })
.collect()
}