nushell / nufmt

MIT License
64 stars 8 forks source link

strange condition and debug statement #37

Closed amtoine closed 1 year ago

amtoine commented 1 year ago

@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? :open_mouth: https://github.com/nushell/nufmt/blob/1765f8e5191b42aad4c7b72b89bef1de05a4eed2/src/lib.rs#L21-L23

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

AucaCoyan commented 1 year ago

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 commented 1 year ago

oooooh i get it, thanks for the clarification :yum:

maybe file is already formatted correctly would be clearer? :open_mouth:

AucaCoyan commented 1 year ago

That sounds great!