It's good to be aware that this might be a problem for you, but past patterns don't have to be future ones.
It sounds like you're talking about something that happened a few hours ago, and that is not influencing you right at the moment, except in that you feel guilty. So probably you can do what mal suggested. Move on.
Is it possible that in future, you might help save yourself from worrying about something like this by making sure that you're not in a situation where you're quite hungry, and facing down a Snickers at the same time?
If you're in the moment facing the situation where you are feeling very tempted to keep going with the sugar, shifting yourself physically to a new location away from it, and getting very physically active will help. Engrossing physical exercise is a great alternative. Some other activity that you find engrossing and which keeps your hands busy, is another good move.