Unless I'm mistaken, it looks perhaps equivalent to the following. I think it might be a bit easier to work with if you keep things flat and serialized?
fn norm2(orig: &str) -> (&str, bool) {
// Try to strip off one ! If we can't return.
let Some(first) = orig.strip_suffix("!") else {
return (orig, false);
};
// Try to strip off another !, if we can't return
// what we had already stripped.
let Some(second) = first.strip_suffix("!") else {
return (first, true);
};
// Finally, check if there was a third !, if there was
// not, then we return only the first split.
if !second.ends_with("!") {
return (first, false);
}
// Otherwise, accept our second split with true.
(second, true)
}