ros2_rust icon indicating copy to clipboard operation
ros2_rust copied to clipboard

Crate imports_granularity requires nightly

Open maspe36 opened this issue 1 year ago • 4 comments

This was identified by @luca-della-vedova here.

Currently, our CI doesn't actually check that our imports are formatted with crate level import granularity. Additionally, this functionality is an unstable feature (https://github.com/rust-lang/rustfmt/issues/4991) so it's only supported in nightly.

Running locally without a nightly toolchain

ros2_rust/rclrs$ cargo fmt
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.

The way I see it, we have two options.

  1. We manually check imports and try to catch this in PRs
  2. We start using a nightly toolchain in our CI. We can mitigate some of the churn for nightly here by selecting a version ourselves.

maspe36 avatar Apr 29 '24 16:04 maspe36

Isn't this something that should be mentioned directly in the readmy or .rustfmt.toml as a comment? The Cargo manifest format allows comments starting with #.

Guelakais avatar Apr 30 '24 08:04 Guelakais

@maspe36 I prefer to only target stable for builds, however we could target nightly for formatting, but I wonder how much of a moving target it is.

esteve avatar Apr 30 '24 09:04 esteve

#396 should get us what we want. It will continue to build and test the repo using the stable channel but use nightly when checking the format.

mxgrey avatar Apr 30 '24 16:04 mxgrey

Ah yeah, I didn't word the second option well but #396 is exactly what I was referring to. We can close once that's merged.

maspe36 avatar Apr 30 '24 17:04 maspe36