Lint clippy::format_push_string
warning clippy::format_push_string §
warning clippy::format_push_string §
Targets (1)
cargo-clippy-html (bin)
Primary: src/render/paths.rs:76:17
note: you may need to import the `std::fmt::Write` trait
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#format_push_string
note: `-W clippy::format-push-string` implied by `-W clippy::pedantic`
help: to override `-W clippy::pedantic` add `#[allow(clippy::format_push_string)]`
help: consider using `write!` to avoid the extra allocation
Suggestion: consider using `write!` to avoid the extra allocation
--- "a/src/render/paths.rs"
+++ "b/src/render/paths.rs"
@@ -73,7 +73,7 @@
name.push(ch);
} else {
for byte in ch.to_string().bytes() {
- name.push_str(&format!("~{byte:02X}"));
+ let _ = write!(name, "~{byte:02X}");
}
}
}
Rendered diagnostic (text)
warning: `format!(..)` appended to existing `String`
--> src/render/paths.rs:76:17
|
76 | name.push_str(&format!("~{byte:02X}"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: you may need to import the `std::fmt::Write` trait
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#format_push_string
= note: `-W clippy::format-push-string` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::format_push_string)]`
help: consider using `write!` to avoid the extra allocation
|
76 - name.push_str(&format!("~{byte:02X}"));
76 + let _ = write!(name, "~{byte:02X}");
|