| > allow supporting any number of spaces As long as nothing is depending on 'static lifetime further down the line. (EDIT: ignore and see below) > (or at least increase the upper limit to 16) That should be doable for sure. Even something like (I'm not a rust developer, just have a passing familiarity, so my syntax may be off): IndentStyle::Spaces(n) if 0 < n && n <= 16 => &" "[0..n as usize],
I think that would condense it all down into one line, rather than having special cases for all of 1 through 16.EDIT: after toying around in the rust playground, I think the following will support any indent level (within the bounds of the u8 type). At the top level: static INDENTS: [u8: 256] = [' '; 256];
And then in the as_str function: IndentStyle::Spaces(n) => std::str::from_utf8(&INDENTS[0..n as usize]).unwrap()
|