diff --git a/Configurations.md b/Configurations.md index c3c3048aca0..0a028e310f2 100644 --- a/Configurations.md +++ b/Configurations.md @@ -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` diff --git a/src/formatting/trim_final_newlines.rs b/src/formatting/trim_final_newlines.rs index 92a3e81d74c..f0e1feb2a7c 100644 --- a/src/formatting/trim_final_newlines.rs +++ b/src/formatting/trim_final_newlines.rs @@ -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() diff --git a/tests/target/configs/trim_final_newlines/never.rs b/tests/target/configs/trim_final_newlines/never.rs index 54e347d3289..df36c00fbcf 100644 --- a/tests/target/configs/trim_final_newlines/never.rs +++ b/tests/target/configs/trim_final_newlines/never.rs @@ -5,6 +5,7 @@ fn lorem() { let sit = vec!["amet", "consectetur", "adipiscing", "elit."]; } + + - - + \ No newline at end of file