-
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
Remove spaces from import statements #7859
Conversation
// ``` | ||
if memchr::memchr(b'\\', f.context().source()[self.0.range()].as_bytes()).is_some() { | ||
text(self.0.as_str(), Some(self.0.start())).fmt(f) | ||
// The backslashes are line continuations |
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.
Can we restore the existing comment, and add a second example to explain that there can be arbitrary whitespace between dots? The new comment feels like a less-useful subset of the existing comment.
.chars() | ||
.filter(|c| !is_python_whitespace(*c) && !matches!(c, '\n' | '\r' | '\\')) | ||
.collect(); | ||
text(&no_whitespace, Some(self.0.start())).fmt(f) |
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.
Annoying that we pass &str
in here only for it to be converted to String
internally when formatting, but I don't see any alternative APIs.
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.
We could change the text element to use Cow
, there are more places where we had owned strings previously.
**Summary** Remove spaces from import statements such as ```python import tqdm . tqdm from tqdm . auto import tqdm ``` See also #7760 for a better solution. **Test Plan** New fixtures
350ea0d
to
5de4bd4
Compare
Summary Remove spaces from import statements such as
See also #7760 for a better solution.
Test Plan New fixtures