Remove trailing newline at the end of the string
- Dominant language
- Rust
- Stars
- 789
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
I am using this crate, along with [`indent`](https://docs.rs/indent/latest/indent/), to generate code. For example:
```rust
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
```rust
fn do_things() -> bool {
println!("hello world");
return true;
}
```
but it actually produces
```rust
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
```rust
indoc::indoc! {r#"
stuff"#};
```
or
```rust
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.