Skip to content

Commit

Permalink
Format module level docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyphack committed Jan 30, 2024
1 parent 6bb1264 commit bef24c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/ruff_python_formatter/src/statement/suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,13 @@ impl FormatRule<Suite, PyFormatContext<'_>> for FormatSuite {
SuiteChildStatement::Other(first)
}
}
SuiteKind::TopLevel => SuiteChildStatement::Other(first),
SuiteKind::TopLevel => {
if let Some(docstring) = DocstringStmt::try_from_statement(first, self.kind) {
SuiteChildStatement::Docstring(docstring)
} else {
SuiteChildStatement::Other(first)
}
}
};

let first_comments = comments.leading_dangling_trailing(first);
Expand Down

0 comments on commit bef24c2

Please sign in to comment.