Make loads from @rules_rust//rust:defs.bzl come out on one line #1753
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At first I was confused why some of the generated files were coming out with loads formatted like this:
rules_rust/crate_universe/3rdparty/crates/BUILD.anyhow-1.0.68.bazel
Lines 9 to 13 in 4ef3d4a
Surely this should be as follows? The wrapped line is even shorter than the unwrapped line.
It turned out to be because crate_universe unconditionally generates all the loads that might be needed:
and then Buildifier deletes any that are unused, but without rewrapping any lines:
This PR tweaks crate_universe to generate only loads that are used, so that we retain control over how they are wrapped. After this PR, single loads get put on one line while multiple loads get put on multiple lines.
rules_rust/crate_universe/3rdparty/crates/BUILD.anyhow-1.0.68.bazel
Lines 9 to 10 in e987f20
rules_rust/bindgen/3rdparty/crates/BUILD.bindgen-0.60.1.bazel
Lines 9 to 14 in e987f20