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 7329bf4 commit fc22e42
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/ruff_python_formatter/src/statement/suite.rs
Expand Up @@ -138,7 +138,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 fc22e42

Please sign in to comment.