riker-rs / riker

Easily build efficient, highly concurrent and resilient applications. An Actor Framework for Rust.
https://riker.rs
MIT License
1.02k stars 69 forks source link

Change rustfmt newline_style to "Auto" #107

Closed hardliner66 closed 4 years ago

hardliner66 commented 4 years ago

I'm currently using auto-crlf in git. With newline_style "Unix" I always have "changed" files in git because the newlines don't match. Setting it to "Native" would solve that for me, but everyone who uses auto-crlf false will than have the same problem.

I think it would be better to leave the newlines as is while formatting because git already handles that conversion.

igalic commented 4 years ago

what about doing this via .gitattributes?

hardliner66 commented 4 years ago

what do you mean?

igalic commented 4 years ago

we can use .gitattributes to enforce a specific end-lines style, regardless of editor or platform

and this will not depend on a pre-commit hook fat someone may have forgotten to configure before sending us their patch

hardliner66 commented 4 years ago

Ah, now I get what you mean.

The thing is, I already have autocrlf enabled which already takes care of line endings on windows.

Currently everytime I format my code with cargo-fmt, git tells me my files have changed because of the new-lines. If I commit those, after the next pull git automatically changes the line endings of changed or new files back because of autocrlf.

There is no need to enforce consistant line endings on each individuals machine as long as they are consistant inside the repo.

igalic commented 4 years ago

exactly, and that's what .gitattributes should take care of