I am using this crate, along with indent, to generate code. For example:
let inner = indent::indent_by(4, indoc::indoc! {r#"
println!("hello world");
return true;
"#});
let outer = indoc::formatdoc! {r#"
fn do_things() -> bool {{
{inner}
}}
"#};
The result should be
fn do_things() -> bool {
println!("hello world");
return true;
}
but it actually produces
fn do_things() -> bool {
println!("hello world");
return true;
}
Notice the extra newlines after the strings created by the indoc macros. I could fix this by doing either
indoc::indoc! {r#"
stuff"#};
or
indoc::indoc! {r#"
stuff
"#}.trim_end().to_string();
but both of these options are ugly, and I am using this crate entirely to not have ugly. I think that this idea is appropriate considering this crate already removes the leading newline as well.
I am using this crate, along with
indent, to generate code. For example:The result should be
but it actually produces
Notice the extra newlines after the strings created by the
indocmacros. I could fix this by doing eitheror
but both of these options are ugly, and I am using this crate entirely to not have ugly. I think that this idea is appropriate considering this crate already removes the leading newline as well.