-
Notifications
You must be signed in to change notification settings - Fork 888
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
cargo fmt stopped working since 1.44.0 #4266
Comments
MWE:
However, the below works correctly 🤔
|
I'm not sure we've ever fully supported this scenario (see #3253), even though I've convinced myself on a few occasions that we were previously close 😆 Also FWIW, I'm able to reproduce the issue with rustfmt 1.4.12 in identical cfg_if scenarios |
Disregard ☝️ |
@calebcartwright I don't think this is fixed on the master; I can still reproduce this locally using the master branch. This seems the problem: rustfmt/src/formatting/modules.rs Lines 24 to 26 in 5ac191d
The |
well that's puzzling 🤔 I'll check again with 2.0
$ cargo fmt --version
rustfmt 1.4.18-nightly (c1e9b7b8 2020-06-13)
$ pwd
/home/caleb/dev/druid
$ cargo fmt -- --check
Diff in /home/caleb/dev/druid/druid-shell/src/window.rs at line 14:
//! Platform independent window types.
- use std::any::Any;
+use std::any::Any;
use std::time::Duration;
use _crate::application::Application;_ |
@calebcartwright You are modifying the wrong file 😉 You should change one of the files under druid-shell/src/platform/ other than mod.rs. |
crikey 🤦♂️ sorry for the noise! I started looking at this earlier but had to stop, and assumed I had the right file up when I came back 😆 |
I'm trying to format code for the druid project.
Everything was working fine up until Rust 1.43.1 / rustfmt 1.4.12-stable (a828ffe 2020-03-11).
It no longer works properly with:
Rust 1.44.0 / rustfmt 1.4.14-stable (e417356 2020-04-21)
Rust 1.44.1 / rustfmt 1.4.16-stable (939e164 2020-06-11)
It does not seem to be platform dependant, the issue exists at minimum both on Windows 7 and macOS Catalina, and not just my machines.
The druid workspace consists of several packages including
druid-shell
which is the package that is problematic.If I run
cargo fmt
inside thedruid-shell
package root then it works.The problem is with using
cargo fmt
orcargo fmt --all
in the workspace directory.That used to also work, but now works only partially on
druid-shell
.Some of the modules get formatted while others don't.
It seems to have something to do with the
cfg-if
macro.A file of interest is
druid-shell/src/platform/mod.rs
, which has the following code:If I delete that macro and replace it with a simple:
Then the
windows
module gets formatted when I runcargo fmt
in the workspace directory. However if thecfg-if
macro is there, then none of these platform modules get formatted. Again, this is a recent regression and previously all those platform modules got formatted.Any insight would be appreciated.
The text was updated successfully, but these errors were encountered: