mimblewimble / grin

Minimal implementation of the Mimblewimble protocol.
https://grin.mw/
Apache License 2.0
5.04k stars 990 forks source link

Make of this what you will but it cargo fmt better #3572

Closed gilescope closed 3 years ago

gilescope commented 3 years ago

Purely asthetics - no functional change. (Leading _ are not allowed.)

( I won't at all be offended if you don't want to merge this. Totally up to you. )

antiochp commented 3 years ago

Q) Have you tried running clippy against this? What does it make of the _ suffixes?

quentinlesceller commented 3 years ago

Clippy complains:

warning: digits grouped inconsistently by underscores
  --> core/src/genesis.rs:80:6
   |
80 |                     16994232_, 22975978_, 32664019_, 44016212_, 50238216_, 57272481_, 85779161_,
   |                     ^^^^^^^^^ help: consider: `16_994_232`
   |
   = note: `#[warn(clippy::inconsistent_digit_grouping)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

warning: digits grouped inconsistently by underscores
  --> core/src/genesis.rs:80:17
   |
80 |                     16994232_, 22975978_, 32664019_, 44016212_, 50238216_, 57272481_, 85779161_,
   |                                ^^^^^^^^^ help: consider: `22_975_978`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

warning: digits grouped inconsistently by underscores
  --> core/src/genesis.rs:80:28
   |
80 |                     16994232_, 22975978_, 32664019_, 44016212_, 50238216_, 57272481_, 85779161_,
   |                                           ^^^^^^^^^ help: consider: `32_664_019`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

warning: digits grouped inconsistently by underscores
  --> core/src/genesis.rs:80:39
   |
80 |                     16994232_, 22975978_, 32664019_, 44016212_, 50238216_, 57272481_, 85779161_,
   |                                                      ^^^^^^^^^ help: consider: `44_016_212`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

warning: digits grouped inconsistently by underscores
  --> core/src/genesis.rs:80:50
   |
80 |                     16994232_, 22975978_, 32664019_, 44016212_, 50238216_, 57272481_, 85779161_,
   |                                                                 ^^^^^^^^^ help: consider: `50_238_216`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

warning: digits grouped inconsistently by underscores
  --> core/src/genesis.rs:80:61
   |
80 |                     16994232_, 22975978_, 32664019_, 44016212_, 50238216_, 57272481_, 85779161_,
   |                                                                            ^^^^^^^^^ help: consider: `57_272_481`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

warning: digits grouped inconsistently by underscores
  --> core/src/genesis.rs:80:72
   |
80 |                     16994232_, 22975978_, 32664019_, 44016212_, 50238216_, 57272481_, 85779161_,
   |                                                                                       ^^^^^^^^^ help: consider: `85_779_161`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

warning: digits grouped inconsistently by underscores
   --> core/src/genesis.rs:192:6
    |
192 |                     4391451__, 36730677_, 38198400_, 38797304_, 60700446_, 72910191_, 73050441_,
    |                     ^^^^^^^^^ help: consider: `4_391_451`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

warning: digits grouped inconsistently by underscores
   --> core/src/genesis.rs:192:17
    |
192 |                     4391451__, 36730677_, 38198400_, 38797304_, 60700446_, 72910191_, 73050441_,
    |                                ^^^^^^^^^ help: consider: `36_730_677`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

warning: digits grouped inconsistently by underscores
   --> core/src/genesis.rs:192:28
    |
192 |                     4391451__, 36730677_, 38198400_, 38797304_, 60700446_, 72910191_, 73050441_,
    |                                           ^^^^^^^^^ help: consider: `38_198_400`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

warning: digits grouped inconsistently by underscores
   --> core/src/genesis.rs:192:39
    |
192 |                     4391451__, 36730677_, 38198400_, 38797304_, 60700446_, 72910191_, 73050441_,
    |                                                      ^^^^^^^^^ help: consider: `38_797_304`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

warning: digits grouped inconsistently by underscores
   --> core/src/genesis.rs:192:50
    |
192 |                     4391451__, 36730677_, 38198400_, 38797304_, 60700446_, 72910191_, 73050441_,
    |                                                                 ^^^^^^^^^ help: consider: `60_700_446`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

warning: digits grouped inconsistently by underscores
   --> core/src/genesis.rs:192:61
    |
192 |                     4391451__, 36730677_, 38198400_, 38797304_, 60700446_, 72910191_, 73050441_,
    |                                                                            ^^^^^^^^^ help: consider: `72_910_191`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping

I'd agree this is a bit weird.

gilescope commented 3 years ago

Hmm. I wonder if they've been to hasty warning about trailing underscores. I do feel we should be able to have our cake and eat it somehow. ( have asked them https://github.com/rust-lang/rust-clippy/issues/6836 as they've probably never considered this usage before). I guess we could turn off this specific clippy warning. That might be as good as it gets.

phyro commented 3 years ago

Is it be possible to disable the clippy warning for these lines only e.g. something like https://stackoverflow.com/questions/55402812/how-to-disable-a-clippy-lint-for-a-single-line-block ?

phyro commented 3 years ago

@gilescope I suggest we try if the above approach works since it seems to get us much better visibility without ignoring the warning throughout the project :+1: