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

Unexpected string literal indents #2695

Closed
choubacha opened this issue May 10, 2018 · 4 comments
Closed

Unexpected string literal indents #2695

choubacha opened this issue May 10, 2018 · 4 comments

Comments

@choubacha
Copy link
Contributor

Rust 1.26 was just released and it appears to have changed some aspect of rustfmt as well. I ran cargo fmt on my repo (https://github.com/kbacha/stellar-sdk) and pushed the changes. However, it failed on CI because of a format issue. We run a format check so that we don't merge poorly formatted code:
https://travis-ci.org/kbacha/stellar-sdk/builds/377478444?utm_source=github_status&utm_medium=notification

image

I went local again and ran cargo fmt again and got:

image
and again:
image

Then I moved to another repo and recreated it here:
https://github.com/kbacha/cargo-fmt-err-1-26

It appears to only matter inside a macro_rules as far as I can tell.

@topecongiro
Copy link
Contributor

Thank you for filing an issue!

I think that this is already fixed via #2589, but unfortunately the latest stable version (rustfmt 0.4.1-stable (7a80726 2018-04-20)) does not include the change.
Would you mind trying the nightly version of rustfmt? The issue should be fixed with it. Please refer to https://github.com/rust-lang-nursery/rustfmt#quick-start for how to install and use it.

choubacha added a commit to choubacha/stellar-rust-sdk that referenced this issue May 11, 2018
Now that there's a new version, there's a small change to the formatter.
This updates the code base for that.

Added a small disabling rustfmt: #[cfg_attr(rustfmt, rustfmt_skip)]

Reference ticket:
rust-lang/rustfmt#2695
choubacha added a commit to choubacha/stellar-rust-sdk that referenced this issue May 11, 2018
Now that there's a new version, there's a small change to the formatter.
This updates the code base for that.

Added a small disabling rustfmt: #[cfg_attr(rustfmt, rustfmt_skip)]

Reference ticket:
rust-lang/rustfmt#2695
@choubacha
Copy link
Contributor Author

Yep, it does appear that it isn't broken in the nightly version. When do you think the next version will release?

choubacha added a commit to choubacha/stellar-rust-sdk that referenced this issue May 11, 2018
Now that there's a new version, there's a small change to the formatter.
This updates the code base for that.

Added a small disabling rustfmt: #[cfg_attr(rustfmt, rustfmt_skip)]

Reference ticket:
rust-lang/rustfmt#2695
@topecongiro
Copy link
Contributor

AFAICT stable rustfmt shipped by rustup is infrequently update, only when the new rustc version is released. So I think that we have to wait for the next rustc's 1.27 release to see stable rustfmt gets updated.
Ping @nrc for more information, do you have a clear view on how rustup chooses the rustfmt version?

@nrc
Copy link
Member

nrc commented May 12, 2018

The version rustup chooses is the submodule on the branch in the Rust repo. We can't change that in stable/beta without doing a point release of Rust itself, which I don't think we can get away with for this.

Going to close this issue since it is fixed on master. As a work around I would recommend using beta or nightly, just for rustfmt'ing

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

No branches or pull requests

3 participants