-
Notifications
You must be signed in to change notification settings - Fork 925
rustfmt result are not reproducable with indent_style = "Visual"
#2496
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
Temporarly switch to sidestep rust-lang/rustfmt#2496 so people can start using rustfmt and the CI test succed.
Temporarly switch to sidestep rust-lang/rustfmt#2496 so people can start using rustfmt and the CI test succed.
Fixed as of version |
Nevermind it's still happening, I hadn't drunk coffee yet sorry! |
`indent_style = "Visual"` tends to switch between styles. See rust-lang/rustfmt#2496.
This is still happening on @alatiera also added a CI job that runs Diff in /builds/alatiera/librsvg/rsvg_internals/src/structure.rs at line 238:
Attribute::X => self.x.set(parse("x", value, LengthDir::Horizontal, None)?),
Attribute::Y => self.y.set(parse("y", value, LengthDir::Vertical, None)?),
- Attribute::Width => {
- self.w.set(parse("width",
- value,
- LengthDir::Horizontal,
- Some(RsvgLength::check_nonnegative)).map(Some)?)
- }
- Attribute::Height => {
- self.h.set(parse("height",
- value,
- LengthDir::Vertical,
- Some(RsvgLength::check_nonnegative)).map(Some)?)
- }
+ Attribute::Width => self.w
+ .set(parse("width",
+ value,
+ LengthDir::Horizontal,
+ Some(RsvgLength::check_nonnegative)).map(Some)?),
+ Attribute::Height => self.h
+ .set(parse("height",
+ value,
+ LengthDir::Vertical,
+ Some(RsvgLength::check_nonnegative)).map(Some)?),
_ => (),
} which in the second run gets reverted back: Diff in /builds/alatiera/librsvg/rsvg_internals/src/structure.rs at line 242:
Attribute::X => self.x.set(parse("x", value, LengthDir::Horizontal, None)?),
Attribute::Y => self.y.set(parse("y", value, LengthDir::Vertical, None)?),
- Attribute::Width => self.w
- .set(parse("width",
- value,
- LengthDir::Horizontal,
- Some(RsvgLength::check_nonnegative)).map(Some)?),
- Attribute::Height => self.h
- .set(parse("height",
- value,
- LengthDir::Vertical,
- Some(RsvgLength::check_nonnegative)).map(Some)?),
+ Attribute::Width => {
+ self.w.set(parse("width",
+ value,
+ LengthDir::Horizontal,
+ Some(RsvgLength::check_nonnegative)).map(Some)?)
+ }
+ Attribute::Height => {
+ self.h.set(parse("height",
+ value,
+ LengthDir::Vertical,
+ Some(RsvgLength::check_nonnegative)).map(Some)?)
+ }
_ => (),
} |
Found a short example: a cycle between fn main() {
match option {
None => some_function(first_reasonably_long_argument,
second_reasonably_long_argument),
}
} and fn main() {
match option {
None => {
some_function(first_reasonably_long_argument,
second_reasonably_long_argument)
}
}
} |
We want to start using
rustfm
t on the code base oflibrsvg
. I've stumbled on a bug though where if you runrustfmt
once it will change the files, but if run again it will reset them to the previous state. This seem to happen no matter which of those 2 states the code base sits. I am not sure how to describe it better.This is sort of a blocker since the CI
rustfmt
test will always fail :(Using
rustfmt 0.3.8
I've made a separate branch to test this.
Steps to reproduce:
git clone https://gitlab.gnome.org/alatiera/librsvg.git --branch rustfmt-visual-bug
cargo fmt --all
cargo fmt --all
againThe text was updated successfully, but these errors were encountered: