Closed
Description
What it does
If it finds a hard-coded IP address that's identical to the corresponding std::net::Ipv{4,6}Addr::LOCALHOST
, then it suggests replacing it by the associated const
ant. This should be auto-fixable as it's MachineApplicable
Advantage
Clarity
Drawbacks
Cognitive indirection? For a reader to see the actual IP address, they have to find the const
definition
Example
std::net::Ipv4Addr::new(127, 0, 0, 1);
Could be written as:
std::net::Ipv4Addr::LOCALHOST;