Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Simplify math by using MAX associated const #9189

Closed
wants to merge 6 commits into from

Conversation

gilescope
Copy link
Contributor

@gilescope gilescope commented Jun 23, 2021

Use u32::MAX rather than u32::max_value(). Easier to read code.

(I will do the min as a separate PR so that it's a little easier to review the PR - unless you'd prefer them both in the same?)

(Also should we have Weight::MAX, BallanceOf::<T>::MAX and Bounded::MAX ? if so happy to do that in a separate PR)

@gilescope
Copy link
Contributor Author

Let me redo that - seemed to not start from the right place.

@andresilva
Copy link
Contributor

IMO this is going a bit too much into "personal opinions" direction and you'll probably get some push back from these changes. I personally don't think there's any difference in comprehension between u32::max_value() vs u32::MAX. Just my 2 cents though.

@bkchr
Copy link
Member

bkchr commented Jun 23, 2021

Yeah, there is really no difference.

@ordian
Copy link
Member

ordian commented Jun 23, 2021

2021-06-23_21-11

@andresilva
Copy link
Contributor

@ordian I didn't know that, in that case it seems sensible.

This was referenced Jun 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants