]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/format_push_string.rs
Auto merge of #9148 - arieluy:then_some_unwrap_or, r=Jarcho
[rust.git] / clippy_lints / src / format_push_string.rs
index ee15ae9f59aca8eb96429d52464b3c53ae689a5b..ebf5ab086dcea7ae6966984ad8810a47c39fcf3a 100644 (file)
     /// ### 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();
@@ -27,9 +33,9 @@
     /// let mut s = String::new();
     /// let _ = write!(s, "0x{:X}", 1024);
     /// ```
-    #[clippy::version = "1.61.0"]
+    #[clippy::version = "1.62.0"]
     pub FORMAT_PUSH_STRING,
-    perf,
+    restriction,
     "`format!(..)` appended to existing `String`"
 }
 declare_lint_pass!(FormatPushString => [FORMAT_PUSH_STRING]);