RS.CLIPPY.BYTES_NTH

Replace `.bytes().nth()` with `.as_bytes().get()`

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: bytes_nth. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for the use of .bytes().nth().

Why is this bad?

.as_bytes().get() is more efficient and more readable.

Example

"Hello".bytes().nth(3);

Use instead:

"Hello".as_bytes().get(3);