Simplify the code:
- Pull a lambda function out of a `for`-loop (making it clearer that the
loop itself is pretty simple), and
- move the `ActionUserInfo` struct into the only function that uses it.
No functional changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/131424