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

Canonicalise use foo::{self} with merge_derives #4574

Closed
ndmitchell opened this issue Dec 3, 2020 · 5 comments
Closed

Canonicalise use foo::{self} with merge_derives #4574

ndmitchell opened this issue Dec 3, 2020 · 5 comments

Comments

@ndmitchell
Copy link

With merge_derives enabled, rustfmt (rustfmt 1.4.22-nightly (97d0301 2020-10-04)) changes:

  • use foo::{bar} to use foo::bar
  • use foo::self to use foo

But it doesn't change use foo::{self} to use foo. Such statements can arise through automated refactoring and would be useful to transform.

@goffrie
Copy link
Contributor

goffrie commented Dec 16, 2020

I also find that converting foo::{self} to foo has always been what I want, but this is intentional as it is technically an unsound conversion: rust-lang/rust#60941 / #3753

@calebcartwright
Copy link
Member

I also find that converting foo::{self} to foo has always been what I want, but this is intentional as it is technically an unsound conversion: rust-lang/rust#60941 / #3753

Correct. Thanks @goffrie!

Going to go ahead and close, but thanks for reaching out @ndmitchell

@ndmitchell
Copy link
Author

Is foo::{self} to foo::self unsound? That isn't done and would be reasonable from reading above, I think.

@goffrie
Copy link
Contributor

goffrie commented Dec 17, 2020 via email

@calebcartwright
Copy link
Member

foo::self isn't legal Rust syntax, oddly enough.

Correct, we actually used to have a bug where rustfmt would do the requested behavior (#3808). The requested feature is definitely not something we should do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants