nearest_utility

Function nearest_utility 

Source
pub fn nearest_utility(name: &str) -> Option<(usize, &'static str)>
Expand description

The utility nearest a name, and how far away it is.

Over enumerate’s closed names, which is the whole table but for the open scales: p-2.75 is a utility and no misspelling of it is close to a name, because the thing that went wrong there is a number.

It answers with the distance rather than applying the threshold, so a caller can ask how far — which is what turns check_classes’s gate from “did it warn” into “how much room does the rule have”, and the second is the one that can fail before a user notices.