Skip to content

Commit

Permalink
test: fix test case and remove wrong description
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhr committed Apr 8, 2023
1 parent c985384 commit c6a10bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2003,7 +2003,7 @@ Final newlines will be trimmed completely.

#### `Never`

Final newlines will be left as is (actually preserving spaces and tabs is not possible for now due to a known problem [#887](https://github.com/rust-lang/rustfmt/issues/887)).
Final newlines will be left as is.

## `normalize_comments`

Expand Down
3 changes: 2 additions & 1 deletion src/formatting/trim_final_newlines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ pub(crate) fn apply_trim_final_newlines(
}
TrimFinalNewlines::Never => {
*formatted_text = formatted_text.trim_end().to_string();
// FIXME: We perform some extra work here to trying to get the original because `formatted_text` is already modified, but sadly even `raw_input_text` doesn't seem to be the original actually. This might be related to [#887](https://github.com/rust-lang/rustfmt/issues/887). Once we've got a new option for it, then we might be able to remove the body of this match arm.
// We perform some extra work here to try to get the original
// because `formatted_text` is already modified.
formatted_text.push_str(
raw_input_text
.chars()
Expand Down
5 changes: 3 additions & 2 deletions tests/target/configs/trim_final_newlines/never.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ fn lorem() {
let sit = vec!["amet", "consectetur", "adipiscing", "elit."];
}







0 comments on commit c6a10bc

Please sign in to comment.