-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Format import statements #5493
Format import statements #5493
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
text("from"), | ||
space(), | ||
dynamic_text(&level_str, None), | ||
module.as_ref().map(AsFormat::format), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was surprised there wasn't a blanket Option<T>: T: AsFormat
impl for .format()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I ran into issues when I tried adding it last time because Rust doesn't know that T doesn't implement Format and AsFormat at the same time
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinux
Windows
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Niiiceee!
+ | ||
+ | ||
+def spam() -> None: | ||
+ ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this PR: interesting, black sometimes keeps the single statement formatting
Summary
Format import statements in all their variants. Specifically, this implemented formatting
StmtImport
,StmtImportFrom
andAlias
.Test Plan
I added some custom snapshots, even though this has been covered well by black's tests.