Yeah, I can see that. That would get unrecognizable quickly.
This sounds suspiciously like string manipulations... which is a can of worms.
And Rust forces you to deal with them and it is a big departure from yoloing it with indexing into them like most other languages do it.
Honestly it was and still is sometimes a big headscratcher for me but the standard tools provided for dealing with them are powerful and it takes time to get used to them.
Try advent of code puzzles to familiarize yourself with them, I find those quite entertaining.
You will see that asking if something is not empty has better alternatives like skipping the step and just iterate directly since you have to deal with None anyway.
There are a lot of things that Rust approaches slightly differently and patterns you're used to from other languages work but result in somewhat congested Rust code.
I don't agree. Even with ADHD, I haven't missed the ! even once in the past few year at least. If I do miss something like that and it causes me to waste a significant amount of time, that usually means I am in not in a fit state for programming that day. I don't find any if the solutions proposed here to be more readable — quite the opposite. I like the Python's not operator, but it's not going to land in Rust, and I'm okay with that.
Even if that's a real problem for someone, the solution is very simple and doesn't require weird coding styles, writing more code or anything like that: just make operators more visible with font thickness or/and color. If it's possible to make only the ! operator more visible, even better.
I think you have to configure rust-analyzer to emit appropriate semantic tokens for this, but I have this turned on in both neovim and vscode. Sometimes the theme you are using may not fully support semantic token highlighting for rust, but It can be easily done by overriding the operator class. I wonder if rust-analyzer will support emitting different tokens for each operator separately, or it does already and I don't know how to configure only for a specific operator.
I would say that visitor(output) == false clearer even without the analyzer for me. Anyway, thank you for the hint. I will add it in my IDE in case if someone from the forum will use it.