-
Notifications
You must be signed in to change notification settings - Fork 874
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
Inconsistent behavior #2716
Comments
If you run |
@nrc I just ran cargo fmt twice, more serious problem happened.
As you can see, it just keeps adding indents to my code. In summary, it just adds 4 spaces in my code every time I run |
@nrc I investigate this bug a little bit today. Here is my observations. Suppose we have same snippet
in two blocks, the one is inside macro declaration and the another is in main function. (i.e, I guess we have different approach to macro and function). It will look like this
When I try `cargo fmt -- --check```, the information is following
We found two different approach to deal with this json! macro.
And then I apply
just want to indent 4 more spaces for json!()'s argument's content (which is inside {}). And if I run
It seems that reformatting macro invocations is related to the context. And it will have different results in these different contexts. |
THanks for the additional info! Will try and fix this soon... |
This seems to be a duplicate of #2695. |
@topecongiro I'm not sure, because the version of my rustfmt is 2018-05-17. And they said their issue was fixed in the newest nightly 11 days ago. |
I'm chiming in because I just encountered this same issue today. If it helps, the following code provides a consistent reproduction:
The arguments passed to The 1.26.2 stable, 1.27.0-beta.11, and 2018-06-13 nightly toolchains all exhibit the same behavior (I'm currently testing within Windows). |
I think the issue is already fixed on the master (via #2775). We need to add regression tests to close this issue. |
Just installed the latest from |
I was looking into adding a regression test, but it appears this is the same bug as #2607, which has a regression test (even the workaround mentioned in that bug to use curly braces instead of parentheses bypasses the issue with older versions of |
Closed by #2775 |
@nrc should this issue be closed ? |
The problem is as following.
When I run
cargo fmt --all
, it should modify all the files that do not follow the format standard. But after I runningcargo fmt --all -- --check
, it still tells me one file does not have the correct format.Rustfmt version is
nightly-2018-05-17
System is
Ubuntu 18.04
The text was updated successfully, but these errors were encountered: