mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
58 lines
1.8 KiB
Text
58 lines
1.8 KiB
Text
error: `format!(..)` appended to existing `String`
|
|
--> tests/ui/format_push_string.rs:5:5
|
|
|
|
|
LL | string += &format!("{:?}", 1234);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: consider using `write!` to avoid the extra allocation
|
|
= note: `-D clippy::format-push-string` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::format_push_string)]`
|
|
|
|
error: `format!(..)` appended to existing `String`
|
|
--> tests/ui/format_push_string.rs:7:5
|
|
|
|
|
LL | string.push_str(&format!("{:?}", 5678));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: consider using `write!` to avoid the extra allocation
|
|
|
|
error: `format!(..)` appended to existing `String`
|
|
--> tests/ui/format_push_string.rs:15:13
|
|
|
|
|
LL | / hex += &(if upper {
|
|
LL | |
|
|
LL | | format!("{byte:02X}")
|
|
LL | | } else {
|
|
LL | | format!("{byte:02x}")
|
|
LL | | });
|
|
| |______________^
|
|
|
|
|
= help: consider using `write!` to avoid the extra allocation
|
|
|
|
error: `format!(..)` appended to existing `String`
|
|
--> tests/ui/format_push_string.rs:28:9
|
|
|
|
|
LL | / s += &(if let Some(_a) = Some(1234) {
|
|
LL | |
|
|
LL | | format!("{}", 1234)
|
|
LL | | } else {
|
|
LL | | format!("{}", 1234)
|
|
LL | | });
|
|
| |__________^
|
|
|
|
|
= help: consider using `write!` to avoid the extra allocation
|
|
|
|
error: `format!(..)` appended to existing `String`
|
|
--> tests/ui/format_push_string.rs:35:9
|
|
|
|
|
LL | / s += &(match Some(1234) {
|
|
LL | |
|
|
LL | | Some(_) => format!("{}", 1234),
|
|
LL | | None => format!("{}", 1234),
|
|
LL | | });
|
|
| |__________^
|
|
|
|
|
= help: consider using `write!` to avoid the extra allocation
|
|
|
|
error: aborting due to 5 previous errors
|
|
|