Skip to content

File written to cfg_attr path is not formatted #3964

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

Closed
rchaser53 opened this issue Dec 13, 2019 · 3 comments
Closed

File written to cfg_attr path is not formatted #3964

rchaser53 opened this issue Dec 13, 2019 · 3 comments

Comments

@rchaser53
Copy link
Contributor

rchaser53 commented Dec 13, 2019

related: #3933, #3956

The file written to cfg_attr path is not formatted. It seems to be degraded since a178776.
(It works until 61c1601)

@rchaser53
Copy link
Contributor Author

below is an example.

// lib.rs
#[cfg_attr(windows, path = "imp-a.rs")]
#[cfg_attr(not(windows), path = "imp-b.rs")]
mod imp;
pub use imp::A;
// imp-a.rs
    pub struct A;  // This is not formatted
// imp-b.rs
    pub struct B;  // This is also not formatted

@rchaser53
Copy link
Contributor Author

rchaser53 commented Dec 13, 2019

I forgot to add a config file to ignore files except for lib.rs in the last PR. (like this)
So every file is the target for rustfmt. This is the one reason why the test failed to find this degrading.

But there is another problem if I add the config file. The result is the same if I add the config file.
When there are a config file and logic works correctly, the test passes. It's ok.
When there are a config file and logic doesn't work, the test formats and compares lib.rs only. It passes.
When there is not a config file, every file is formatted. It passes.
All pattern is a success every time. I think need to add another way to catch the degrade.

@rchaser53
Copy link
Contributor Author

It's not degrading. The default behavior is changed, so it needs to add the option -r for recursive.
I didn't add the option. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant