near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.34k stars 632 forks source link

Enable wrap_comments in rustfmt #8490

Open akhi3030 opened 1 year ago

akhi3030 commented 1 year ago

This issue is to track enabling wrap_comments feature in rustfmt to put to rest all discussions about where and when to wrap comments.

Also see: https://near.zulipchat.com/#narrow/stream/300659-Rust-.F0.9F.A6.80/topic/wrapping.20comments

akhi3030 commented 1 year ago

I plan on running rustfmt on the repo and to add a CI test.

Ekleog-NEAR commented 1 year ago

Note that even with wrap_comments, rustfmt will not make longer the too-short lines. So people who want to wrap at 120 can still complain about people who manually wrap at 80. That said I’m still in favor of this, as it’s an easy way to stop bikeshedding anything that passes cargo fmt and is not obviously wrong :)

Just as a note, when doing the initial rustfmt, we should check that each comment makes sense. Sometimes rustfmt thinks there’s eg. a willing line break in a paragraph when it’s actually just that the sentence naturally ended at reflow point, so it can generate pretty weird-looking comments that then need to be manually reflowed (and then running rustfmt again leaves them in place).

(Disclaimer: the information here is from now years-old memory and can be wrong nowadays, but I don’t think it changes anything actionable anyway)