This actually is niche optimization. The outer enum is using the niches available in the tag of the inner enum for its own discriminant.
The author seems to have a limited understanding of niche optimization.
replies(1):
The author seems to have a limited understanding of niche optimization.
In any case, the definition of what is exactly niche optimization is besides the point. The point of the post is: the literature gives you the impression that there's one limited form of enum size optimization in the Rust compiler, but in fact there are other optimizations too. And knowing this is useful!
It's useful if you got that specific impression.
But I didn't. So I was disappointed and unenlightened because I was promised a non-niche optimization and I didn't get one.