rust-elements icon indicating copy to clipboard operation
rust-elements copied to clipboard

One shot cargo fmt

Open sanket1729 opened this issue 3 years ago • 8 comments

I think we should do it earlier when the diff is smaller and the project is smaller in scope. Otherwise, it becomes a big task to do it file by file as with rust-bitcoin. So far, we have had good experiences with rust-miniscript. Most rust-bitcoin developers are also in favor of using it, and I think we should get it done when the diff is relatively small and very easy to review/reproduce.

Curious what do @apoelstra, @stevenroose, and others think about this.

sanket1729 avatar Apr 19 '21 23:04 sanket1729

Yeah, I think I can live with this

apoelstra avatar Apr 20 '21 16:04 apoelstra

I'm generally not a fan of formatters. I think formatting can help in presenting and conveying information so formatting is part of the process of writing code and formatting can/should also be a subject of review. Readability of code is important, especially in an information-dense language like Rust. Anyway, my 2 cents, won't veto anything ofc.

But just went through the struggle of formatting rust-secp256k1-zkp various times after submitting to CI :|

stevenroose avatar Oct 06 '21 12:10 stevenroose

@RCasatta I am still seeking concept ACKs on this. What are your opinions on cargo fmt?

sanket1729 avatar Dec 15 '21 14:12 sanket1729

@RCasatta I am still seeking concept ACKs on this. What are your opinions on cargo fmt?

cargo fmt is a strong concept ACK for me.

Sometimes it's not as perfect as manual formatting, like not having bytes vec in octets or spanning a method chain in million lines. However, the benefit of having an automatic check in CI and less formatting nits turnaround outweighs the downsides.

Also, I personally find it useful to write code without thinking about formatting cause I know you can fix it easily and without a doubt.

RCasatta avatar Dec 15 '21 17:12 RCasatta

I plan to go through the diff and add another commit adding rustfmt::skip.

sanket1729 avatar Dec 16 '21 16:12 sanket1729

Based on Yeah, I think I can live with this - @apoelstra cargo fmt is a strong concept ACK for me - @RCasatta

and a minor complaint I'm generally not a fan of formatters. ...won't veto anything ofc - @stevenroose

I will open this for review after adding rustfmt::skip to oddly formatted things.

sanket1729 avatar Dec 16 '21 16:12 sanket1729

concept ACK - I don't ever want to think or bikeshed about formatting

delta1 avatar May 19 '22 11:05 delta1

Reviewing this with a refreshed ACK from @delta1 and the comments posted before. https://github.com/ElementsProject/rust-elements/pull/80#issuecomment-995969709

sanket1729 avatar Jun 09 '22 18:06 sanket1729