Hacker News new | ask | show | jobs
by ryandrake 679 days ago
Kind of low-key hilarious that someone thought this was a serious enough issue to actually submit that code. I wonder if there is a written spec that helps to judge which integers should be considered "problematic" and which ones aren't.
3 comments

Not just that, but they also wrote the numbers in decimal - they didn't even want them in the code as an example of what not to do.

Maybe someone was having too much fun and got carried away, but what an odd sense of humor.

> wrote the numbers in decimal

Maybe they just didn't want the checker to flag itself.

I remember there was a similar check inside Google, where any file containing the words "DO NOT SUBMIT" will cause the presubmit check to fail. Naturally the presubmit checker needs to look for that string, but it couldn't trivially include the string as-is because that would prevent the presubmit checker from being submitted.

(Motivation for something like this is that if you inserted some extra logging statements or similar for debugging, you would add "DO NOT SUBMIT" in nearby comments, so that you will remember to remove them later).

It's also fun if you want to include that string in a template file so that users of the template don't forget to fill in the template before submitting.
But it's clippy, you can just annotate it with an #[allow(problematic_constants)]
It’s not humor.

It’s religion for the irreligious.

The actual diff in question [1] does show that there have been multiple cases where such "magic" numbers did appear in rustc, so that the lint is meant to catch any such known cases to reduce possibly resulting complaints in advance, no matter you like them or not. (This is also why the list is not as exhaustive, as it needn't to be.)

[1] https://github.com/rust-lang/rust/pull/92469/files

And now I can't unrememeber and feel totally compelled to a) translate them and b) use them in my code somewhere. Cannot help but think this is a deliberate pun, to get cynic's imagination going ... did they do this to poke fun at the PC brigade asking for it, or were they actually seriously believing it would make users look the other way ? Either option is funny.

(practically, used only "F0015601D" ... as IPv6 link-local address. No, wasn't a honeypot service)