]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/strings.rs
Give more corrected code examples in doc
[rust.git] / clippy_lints / src / strings.rs
index 2c51271e312dee312c7dac5a126390682b362061..f84566ef707a8e41dbc8a2b00275d7d55c07aeb6 100644 (file)
     /// ```rust
     /// let mut x = "Hello".to_owned();
     /// x = x + ", World";
+    ///
+    /// // More readable
+    /// x += ", World";
+    /// x.push_str(", World");
     /// ```
     pub STRING_ADD_ASSIGN,
     pedantic,
     ///
     /// **Example:**
     /// ```rust
+    /// // Bad
     /// let bs = "a byte string".as_bytes();
+    ///
+    /// // Good
+    /// let bs = b"a byte string";
     /// ```
     pub STRING_LIT_AS_BYTES,
     style,