Stop including string content in index panics?
Rust Internals [Unofficial]
March 10, 2026
ConradIrwin:
or forbid indexing into a string - doesn't seem tenable
You should be able to ban slicing with clippy:
rust-lang.github.io
char_indices - Clippy Lints
Checks for usage of items through absolute paths, like std::env::current_dir. | A collection of lints to catch common mistakes and improve your Rust code.
Discussion in the ATmosphere