Skip to content

rustfmt seems to have stopped formatting files behind configurations? #4034

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

Open
Lokathor opened this issue Jan 30, 2020 · 3 comments
Open
Labels
a-macros a-mods Module resolution. p-low

Comments

@Lokathor
Copy link

rustfmt 1.4.11-nightly (18382352 2019-12-03)

Recently all of my files that are behind config flags stopped formatting with cargo fmt, even if the code would be configured into a current build (eg: a cfg(windows) module on a windows machine).

@Lokathor Lokathor changed the title rustfmt seems to have stopped format files behind configurations? rustfmt seems to have stopped formatting files behind configurations? Jan 30, 2020
@topecongiro
Copy link
Contributor

@Lokathor Thank you for filing an issue! Is it possible to provide a link to the repository with which you have a problem?

@Lokathor
Copy link
Author

Yes, the repo in question was https://github.com/Lokathor/vanadium

@topecongiro
Copy link
Contributor

@Lokathor Thank you for sharing the problematic repository. It looks like the crate is using pick! macro, which rustfmt does not support yet:

pick! {
  if #[cfg(windows)] {
    mod windows;
    use windows as sys;
    type SysTerm = sys::WindowsTerminal;
  } else if #[cfg(unix)] {
    mod unix;
    use unix as sys;
    type SysTerm = sys::UnixTerminal;
  } else {
    compile_error!("This crate doesn't support this system.");
  }
}

Currently, rustfmt is only able to resolve modules that are declared inside macros.

@topecongiro topecongiro added a-macros bug Panic, non-idempotency, invalid code, etc. a-mods Module resolution. labels Feb 18, 2020
@ytmimi ytmimi added p-low and removed bug Panic, non-idempotency, invalid code, etc. labels Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-macros a-mods Module resolution. p-low
Projects
None yet
Development

No branches or pull requests

3 participants