Interestingly Index::index is also usually not marked as `#[must_use]` in Rust either.
I don't believe you can mark trait methods with #[must_use] - it has to be on the implementation. Not near a compiler to check at the moment.
In the case of e.g. Vec, it returns a reference, which by itself is side-effect free, so the compiler will always optimize it. I do agree that it should still be marked as such though. I'd be curious the reasons why it's not.
Unsure if I misunderstand:
Index returns a reference:
https://doc.rust-lang.org/std/ops/trait.Index.html#:~:text=s...
If you don't use the reference it just ... disappears.
Am I missing something here?