-
Notifications
You must be signed in to change notification settings - Fork 925
Rustfmt changes meaning of 2018 import starting with colons #3501
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
Comments
If you put |
|
If you are running |
Thanks, I think this is user error and I should be passing I don't know if this is helpful but I filed #3517 to track bumping the default edition that is assumed when no |
@dtolnay That is indeed helpful, thank you! |
Repro against current master branch (8ec0750):
Output:
The original code imports
::serde::Serialize
which refers to the external crateserde
, not the local module. The formatted code importsserde::Serialize
which refers to the local module and does not exist.Interestingly,
cargo fmt
against the same code does not break the code, presumably becausecargo fmt
somehow understands that the edition of this code is 2018 and so the leading::
is meaningful. In the absence of knowing the edition for sure, would it be possible forrustfmt
to treat this case more conservatively and keep the leading::
? We can continue to remove the colons if the edition is known to be 2015.The text was updated successfully, but these errors were encountered: