-
Notifications
You must be signed in to change notification settings - Fork 912
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
doc: make environment variable setting more explicit. #5822
Conversation
@rzhb Thanks for reaching out. Can you confirm what version of rustfmt you're using? If you're using @calebcartwright do you think we can do a subtree-sync soon to resolve this? |
@ytmimi Maybe we have some misunderstand. This is not about But in Windows and PowerShell, |
@rzhb Yeah, I think there was some misunderstanding. I think I just had the logging issue top of mind so I assumed you had run into an issue. As mentioned above, logging is broken in |
Contributing.md
Outdated
@@ -59,7 +59,7 @@ example, the `issue-1111.rs` test file is configured by the file | |||
## Debugging | |||
|
|||
Some `rewrite_*` methods use the `debug!` macro for printing useful information. | |||
These messages can be printed by using the environment variable `RUSTFMT_LOG=rustfmt=DEBUG`. | |||
These messages can be printed by using the environment variable `RUSTFMT_LOG="rustfmt=DEBUG"`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now I'm wondering if it would be better to mention RUSTFMT_LOG=rustfmt=DEBUG
on linux and add a new sentence to make a distinction for RUSTFMT_LOG="rustfmt=DEBUG"
when using powershell on windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value is a String, it needs the quote. "RUSTFMT_LOG=rustfmt=DEBUG" is just lazy and not formal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rzhb first I want to highlight that I appreciate you helping to improve the docs, but I don't find the criticism to be constructive.
I wouldn't characterize this as lazy since the quotes are unnecessary when working on linux / mac. Given that the current docs are valid for some systems, I suggest making an amendment to the docs that informs powershell users that they need to wrap rustfmt=DEBUG
in quotes. Are the quotes also necessary when running in the windows command prompt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Linux, without quotes works only because there has no whitespace or special characters.
It's better to always quote string for safety.
powershell
$env:RUSTFMT_LOG="rustfmt=DEBUG"
work.
$RUSTFMT_LOG="rustfmt=DEBUG"
didn't.
cmd
set RUSTFMT_LOG="rustfmt=DEBUG"
didn't work. rustfmt
has warning warning: invalid logging spec 'DEBUG"', ignoring it
set RUSTFMT_LOG=rustfmt=DEBUG
work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for looking into this. From my understanding of your last comment the quotes are only required in powershell, and it seems like the quotes actually break things on cmd. Assuming that's the case I now feel more strongly about leaving the existing language as is and adding a note for powershell users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I am fully in agreement with Yacin though, and don't want to move forward with the changes as proposed.
That being said, I'd also agree there's opportunities to improve things. First and foremost, the debug logging should be able to be enabled via the more simple RUSTFMT_LOG=debug
.
The advanced filtering options are powerful, and certainly useful in more complex scenarios like the rustc codebase where you basically never want to build/test/troubleshoot with debugging enabled across the entire compiler, but instead want to only enable it for a subset, like a module.
I'd be completely open to simplifying the text to reflect this, which fwiw could obviate the topic of quotes. Then if necessary, we can mention the filtering feature, with or without examples
I went ahead and changed the docs to read RUSTFMT_LOG=debug
as Caleb suggested
$env:RUSTFMT_LOG=rustfmt=DEBUG
didn't work in PowerShell,$env:RUSTFMT_LOG="rustfmt=DEBUG"
worked.