-
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
F401 sort bindings before adding to __all__ #11648
Conversation
I ended up sorting the slice rather than the result of the iter/map because that saves a copy. I made the function argument |
|
@@ -330,7 +330,7 @@ pub(crate) fn unused_import(checker: &Checker, scope: &Scope, diagnostics: &mut | |||
fix_by_reexporting( | |||
checker, | |||
import_statement, | |||
&to_reexport.iter().map(|(b, _)| b).collect::<Vec<_>>(), | |||
&mut to_reexport.iter().map(|(b, _)| b).collect::<Vec<_>>(), |
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.
Maybe we should just pass in the Vec
here, so the ownership is clearer? Then it can be mut imports: Vec<&ImportBinding>
and callers don't need to worry about the mutation.
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.
Tweaking this quickly so I can include in the release.
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.
Ok! Thanks for explaining
Sort the binding IDs before passing them to the add-to-
__all__
function to address #11619.