Remove an unneeded `compact` call.

This also reduces array allocations, since `compact` would create an
extra array.
Hash#keys.any? creates an extra array compared to Hash#any?
When selecting a hash subset, it’s better to iterate over the smaller key list.

We expect `applicable_keys` to be very small — for example,
in rspec-rails, it may just contain `:type`. `metadata`,
in contrast, typically has at least 9 items.
Use fewer string allocations when creating the example group constant.
Use fewer string allocations in console_code_for.
Fewer array allocations.