mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
7e68c718c0
This adds the missing `&` to the suggestion if the target is a `str` slice (e.g. extending with `"foo"[..].chars()`).
28 lines
830 B
Text
28 lines
830 B
Text
error: calling `.extend(_.chars())`
|
|
--> $DIR/string_extend.rs:18:5
|
|
|
|
|
LL | s.extend(abc.chars());
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(abc)`
|
|
|
|
|
= note: `-D clippy::string-extend-chars` implied by `-D warnings`
|
|
|
|
error: calling `.extend(_.chars())`
|
|
--> $DIR/string_extend.rs:21:5
|
|
|
|
|
LL | s.extend("abc".chars());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str("abc")`
|
|
|
|
error: calling `.extend(_.chars())`
|
|
--> $DIR/string_extend.rs:24:5
|
|
|
|
|
LL | s.extend(def.chars());
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(&def)`
|
|
|
|
error: calling `.extend(_.chars())`
|
|
--> $DIR/string_extend.rs:34:5
|
|
|
|
|
LL | s.extend(abc[0..2].chars());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `s.push_str(&abc[0..2])`
|
|
|
|
error: aborting due to 4 previous errors
|
|
|