KokaKiwi / rust-hex

A basic crate to encode values to hexadecimal representation. Originally extracted from rustc-serialize.
https://crates.io/crates/hex
Apache License 2.0
201 stars 55 forks source link

Make `byte2hex` and `val` const functions #60

Closed Luro02 closed 3 years ago

KokaKiwi commented 3 years ago

Looking at the changes, i was wondering what would be the effect of making these function const? (as they are private)

I suppose maybe some inlining and const-propagation stuff, but i'm not sure.

Luro02 commented 3 years ago

This will most likely have no performance improvements, but clippy will stop complaining about the functions not being constant.

KokaKiwi commented 3 years ago

Eh, i didn't event know clippy had a lint like that :smile:

Luro02 commented 3 years ago

Eh, i didn't event know clippy had a lint like that 😄

By default clippy does not show all lints. You can enable a lot more by adding this to the top of lib.rs:

#![warn(clippy::pedantic, clippy::nursery)]

see table here