blob: e2b4c1db78cf445971b224ca0dbeb54c35d6dc65 [file] [log] [blame]
error: indexing into a string with a character position where a byte index is expected
--> tests/ui/char_indices_as_byte_indices.rs:13:24
|
LL | let _ = prim[..idx];
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:12:10
|
LL | for (idx, _) in prim.chars().enumerate() {
| ^^^ ^^^^^^^^^^^
= note: `-D clippy::char-indices-as-byte-indices` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::char_indices_as_byte_indices)]`
help: consider using `.char_indices()` instead
|
LL - for (idx, _) in prim.chars().enumerate() {
LL + for (idx, _) in prim.char_indices() {
|
error: passing a character position to a method that expects a byte index
--> tests/ui/char_indices_as_byte_indices.rs:15:23
|
LL | prim.split_at(idx);
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:12:10
|
LL | for (idx, _) in prim.chars().enumerate() {
| ^^^ ^^^^^^^^^^^
help: consider using `.char_indices()` instead
|
LL - for (idx, _) in prim.chars().enumerate() {
LL + for (idx, _) in prim.char_indices() {
|
error: passing a character position to a method that expects a byte index
--> tests/ui/char_indices_as_byte_indices.rs:19:49
|
LL | let _ = prim[..prim.floor_char_boundary(idx)];
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:12:10
|
LL | for (idx, _) in prim.chars().enumerate() {
| ^^^ ^^^^^^^^^^^
help: consider using `.char_indices()` instead
|
LL - for (idx, _) in prim.chars().enumerate() {
LL + for (idx, _) in prim.char_indices() {
|
error: indexing into a string with a character position where a byte index is expected
--> tests/ui/char_indices_as_byte_indices.rs:29:24
|
LL | let _ = prim[..c.0];
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:28:9
|
LL | for c in prim.chars().enumerate() {
| ^ ^^^^^^^^^^^
help: consider using `.char_indices()` instead
|
LL - for c in prim.chars().enumerate() {
LL + for c in prim.char_indices() {
|
error: passing a character position to a method that expects a byte index
--> tests/ui/char_indices_as_byte_indices.rs:31:23
|
LL | prim.split_at(c.0);
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:28:9
|
LL | for c in prim.chars().enumerate() {
| ^ ^^^^^^^^^^^
help: consider using `.char_indices()` instead
|
LL - for c in prim.chars().enumerate() {
LL + for c in prim.char_indices() {
|
error: indexing into a string with a character position where a byte index is expected
--> tests/ui/char_indices_as_byte_indices.rs:36:26
|
LL | let _ = string[..idx];
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:35:10
|
LL | for (idx, _) in string.chars().enumerate() {
| ^^^ ^^^^^^^^^^^
help: consider using `.char_indices()` instead
|
LL - for (idx, _) in string.chars().enumerate() {
LL + for (idx, _) in string.char_indices() {
|
error: passing a character position to a method that expects a byte index
--> tests/ui/char_indices_as_byte_indices.rs:38:25
|
LL | string.split_at(idx);
| ^^^
|
= note: a character can take up more than one byte, so they are not interchangeable
note: position comes from the enumerate iterator
--> tests/ui/char_indices_as_byte_indices.rs:35:10
|
LL | for (idx, _) in string.chars().enumerate() {
| ^^^ ^^^^^^^^^^^
help: consider using `.char_indices()` instead
|
LL - for (idx, _) in string.chars().enumerate() {
LL + for (idx, _) in string.char_indices() {
|
error: aborting due to 7 previous errors