We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
char_indices()
chars()
1 parent 47a4865 commit cbdebd9Copy full SHA for cbdebd9
clippy_lints/src/tabs_in_doc_comments.rs
@@ -104,6 +104,9 @@ fn get_chunks_of_tabs(the_str: &str) -> Vec<(u32, u32)> {
104
// tracker to decide if the last group of tabs is not closed by a non-tab character
105
let mut is_active = false;
106
107
+ // Note that we specifically need the char _byte_ indices here, not the positional indexes
108
+ // within the char array to deal with multi-byte characters properly. `char_indices` does
109
+ // exactly that. It provides an iterator over tuples of the form `(byte position, char)`.
110
let char_indices: Vec<_> = the_str.char_indices().collect();
111
112
if let [(_, '\t')] = char_indices.as_slice() {
0 commit comments