Run rustfmt on nightly to clean up erroneous comments (#5106)

## Summary

This PR runs `rustfmt` with a few nightly options as a one-time fix to
catch some malformatted comments. I ended up just running with:

```toml
condense_wildcard_suffixes = true
edition = "2021"
max_width = 100
normalize_comments = true
normalize_doc_attributes = true
reorder_impl_items = true
unstable_features = true
use_field_init_shorthand = true
```

Since these all seem like reasonable things to fix, so may as well while
I'm here.
This commit is contained in:
Charlie Marsh 2023-06-14 20:19:05 -04:00 committed by GitHub
parent 9ab16fb417
commit 716cab2f19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 49 additions and 34 deletions

View file

@ -70,6 +70,7 @@ impl FormatRule<Stmt, PyFormatContext<'_>> for FormatStmt {
impl<'ast> AsFormat<PyFormatContext<'ast>> for Stmt {
type Format<'a> = FormatRefWithRule<'a, Stmt, FormatStmt, PyFormatContext<'ast>>;
fn format(&self) -> Self::Format<'_> {
FormatRefWithRule::new(self, FormatStmt::default())
}
@ -77,6 +78,7 @@ impl<'ast> AsFormat<PyFormatContext<'ast>> for Stmt {
impl<'ast> IntoFormat<PyFormatContext<'ast>> for Stmt {
type Format = FormatOwnedWithRule<Stmt, FormatStmt, PyFormatContext<'ast>>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(self, FormatStmt::default())
}

View file

@ -7,7 +7,6 @@ use ruff_formatter::{write, Buffer, Format, FormatResult};
use ruff_python_ast::prelude::Expr;
use rustpython_parser::ast::StmtAssign;
//
// Note: This currently does wrap but not the black way so the types below likely need to be
// replaced entirely
//

View file

@ -178,6 +178,7 @@ impl<'ast> AsFormat<PyFormatContext<'ast>> for Suite {
impl<'ast> IntoFormat<PyFormatContext<'ast>> for Suite {
type Format = FormatOwnedWithRule<Suite, FormatSuite, PyFormatContext<'ast>>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(self, FormatSuite::default())
}