just/src/show_whitespace.rs
Casey Rodarmor 9731278d2a
Wrap comments at 80 characters (#593)
I think 70 is too agressive, especially since it includes indentation
when determining line length.
2020-02-14 04:49:25 -08:00

19 lines
428 B
Rust

use crate::common::*;
/// String wrapper that uses nonblank characters to display spaces and tabs
pub struct ShowWhitespace<'str>(pub &'str str);
impl<'str> Display for ShowWhitespace<'str> {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
for c in self.0.chars() {
match c {
'\t' => write!(f, "")?,
' ' => write!(f, "")?,
_ => write!(f, "{}", c)?,
};
}
Ok(())
}
}