password-rules-parser
password-rules-parser copied to clipboard
Provide a `Display` implementation for `CharacterClass`
While writing https://github.com/Cldfire/password-rules-checker I came across a place where it would be nice to have a way to pretty-print a CharacterClass:
let possibly_shortened_allows = remove_unecessary_allows(&quirk_parsed);
if quirk_parsed.allowed != possibly_shortened_allows {
// TODO: pretty print the suggestion
println!(
"{}: the `allowed` property for this rule can be shortened to: {:?}",
site, possibly_shortened_allows
);
}
I'd like to print allowed: upper, [%^*]; instead of [Upper, Custom(['%', '^', '*'])]. A Display impl for CharacterClass would make that simple.