Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement StmtPass #4959

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ while (
## Output
```py
while 34: # trailing test comment
NOT_YET_IMPLEMENTED_StmtPass # trailing last statement comment
pass # trailing last statement comment

# trailing while body comment

# leading else comment

else: # trailing else comment
NOT_YET_IMPLEMENTED_StmtPass
pass

# trailing else body comment


while (
aVeryLongConditionThatSpillsOverToTheNextLineBecauseItIsExtremelyLongAndGoesOnAndOnAndOnAndOnAndOnAndOnAndOnAndOnAndOn
): # trailing comment
NOT_YET_IMPLEMENTED_StmtPass
pass

else:
...
Expand Down
9 changes: 5 additions & 4 deletions crates/ruff_python_formatter/src/statement/stmt_pass.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
use ruff_formatter::{write, Buffer, FormatResult};
use crate::{FormatNodeRule, PyFormatter};
use ruff_formatter::prelude::text;
use ruff_formatter::{Format, FormatResult};
use rustpython_parser::ast::StmtPass;

#[derive(Default)]
pub struct FormatStmtPass;

impl FormatNodeRule<StmtPass> for FormatStmtPass {
fn fmt_fields(&self, item: &StmtPass, f: &mut PyFormatter) -> FormatResult<()> {
write!(f, [not_yet_implemented(item)])
fn fmt_fields(&self, _item: &StmtPass, f: &mut PyFormatter) -> FormatResult<()> {
text("pass").fmt(f)
}
}