mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:43 +00:00
Fix handling of newlines in empty files (#7473)
This commit is contained in:
parent
b66bfa6570
commit
0346e781d4
12 changed files with 90 additions and 15 deletions
|
@ -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(())
|
||||
/// # }
|
||||
/// ```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue