Fix handling of newlines in empty files (#7473)

This commit is contained in:
Micha Reiser 2023-09-18 08:08:10 +02:00 committed by GitHub
parent b66bfa6570
commit 0346e781d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 90 additions and 15 deletions

View file

@ -429,7 +429,6 @@ pub type FormatResult<F> = Result<F, FormatError>;
/// impl Format<SimpleFormatContext> for Paragraph {
/// fn fmt(&self, f: &mut Formatter<SimpleFormatContext>) -> FormatResult<()> {
/// write!(f, [
/// hard_line_break(),
/// text(&self.0, None),
/// hard_line_break(),
/// ])
@ -440,7 +439,7 @@ pub type FormatResult<F> = Result<F, FormatError>;
/// let paragraph = Paragraph(String::from("test"));
/// let formatted = format!(SimpleFormatContext::default(), [paragraph])?;
///
/// assert_eq!("\ntest\n", formatted.print()?.as_code());
/// assert_eq!("test\n", formatted.print()?.as_code());
/// # Ok(())
/// # }
/// ```