From 43ac256cd19ebb7a423ed75a2fd0e81af38ececc Mon Sep 17 00:00:00 2001 From: Victor Nordam Suadicani Date: Thu, 14 Jul 2022 13:26:56 +0200 Subject: [PATCH] Add Known problems section --- clippy_lints/src/format_push_string.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/clippy_lints/src/format_push_string.rs b/clippy_lints/src/format_push_string.rs index 17aa482d7..ebf5ab086 100644 --- a/clippy_lints/src/format_push_string.rs +++ b/clippy_lints/src/format_push_string.rs @@ -14,6 +14,12 @@ declare_clippy_lint! { /// ### Why is this bad? /// Introduces an extra, avoidable heap allocation. /// + /// ### Known problems + /// `format!` returns a `String` but `write!` returns a `Result`. + /// Thus you are forced to ignore the `Err` variant to achieve the same API. + /// + /// While using `write!` in the suggested way should never fail, this isn't necessarily clear to the programmer. + /// /// ### Example /// ```rust /// let mut s = String::new();