about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-27 17:33:31 +0000
committerbors <bors@rust-lang.org>2022-06-27 17:33:31 +0000
commitd85539571ffa3befbbdd6b2933a79d31c28b42a0 (patch)
tree22b8a1fe60189344a5c94d2ce6e4a3eb0d53c0a0
parentfdd0e727e2174a53ffca340734bd462f8ea865b8 (diff)
parentc6a222139377b3a357df3b461fdbef0722df5555 (diff)
downloadrust-d85539571ffa3befbbdd6b2933a79d31c28b42a0.tar.gz
rust-d85539571ffa3befbbdd6b2933a79d31c28b42a0.zip
Auto merge of #9045 - alex-semenyuk:self_assignment_example, r=llogiq
Fix example `SELF_ASSIGNMENT`

changelog: Fix example in `SELF_ASSIGNMENT` docs
-rw-r--r--clippy_lints/src/self_assignment.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/clippy_lints/src/self_assignment.rs b/clippy_lints/src/self_assignment.rs
index b14f0518bdb..af7f5c9b681 100644
--- a/clippy_lints/src/self_assignment.rs
+++ b/clippy_lints/src/self_assignment.rs
@@ -20,14 +20,22 @@ declare_clippy_lint! {
     /// ### Example
     /// ```rust
     /// struct Event {
-    ///     id: usize,
     ///     x: i32,
-    ///     y: i32,
+    /// }
+    ///
+    /// fn copy_position(a: &mut Event, b: &Event) {
+    ///     a.x = a.x;
+    /// }
+    /// ```
+    ///
+    /// Should be:
+    /// ```rust
+    /// struct Event {
+    ///     x: i32,
     /// }
     ///
     /// fn copy_position(a: &mut Event, b: &Event) {
     ///     a.x = b.x;
-    ///     a.y = a.y;
     /// }
     /// ```
     #[clippy::version = "1.48.0"]