Skip to content
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

strange condition and debug statement #37

Closed
amtoine opened this issue Jun 25, 2023 · 3 comments · Fixed by #39
Closed

strange condition and debug statement #37

amtoine opened this issue Jun 25, 2023 · 3 comments · Fixed by #39
Labels
question Further information is requested

Comments

@amtoine
Copy link
Member

amtoine commented Jun 25, 2023

@AucaCoyan

i'm a bit confused about that part of format_single_file, why do we want the code before and after to be equal? 😮

nufmt/src/lib.rs

Lines 21 to 23 in 1765f8e

if formatted_bytes == contents {
debug!("File is formatted correctly.");
}

and followup question, why don't we have a similar test and debug statement in format_string?

@amtoine amtoine added the question Further information is requested label Jun 25, 2023
@AucaCoyan
Copy link
Contributor

AucaCoyan commented Jun 25, 2023

It's for the rare case that the file is formatted, and you run the formatter anyways.
In that case, instead of printing to stdout only formatting file...
we can print

formatting file...
file is formatted correctly

if we check and did no change at all.

@amtoine
Copy link
Member Author

amtoine commented Jun 25, 2023

oooooh i get it, thanks for the clarification 😋

maybe file is already formatted correctly would be clearer? 😮

@AucaCoyan
Copy link
Contributor

That sounds great!

amtoine added a commit that referenced this issue Jun 27, 2023
should close #37 by making the
debug message clearer
> File is already formatted correctly.
>
instead of
> File is formatted correctly.

cc/ @AucaCoyan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants