Replace four very similar "ids in request"
In reviewing !553 (merged) I noticed that the empty digest list error had to be handled in two places. I filed #492 (closed) about the duplication.
In fact it turns out to have been quadruplication.
The new code also avoids cloning the underlying objects, instead sorting a Vec of references.
The new code makes it considerably more obvious that one of the cases handles an empty list a bit oddly. I pre-added a test case to demonstrate that my refactoring doesn't change the behaviour (the test passes both before and after). Either my TODOs should be removed, or the code fixed - IMO, in a future MR.