From c6a222139377b3a357df3b461fdbef0722df5555 Mon Sep 17 00:00:00 2001 From: alexey semenyuk Date: Sat, 25 Jun 2022 11:57:32 +0000 Subject: [PATCH] Fix example `SELF_ASSIGNMENT` --- clippy_lints/src/self_assignment.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/clippy_lints/src/self_assignment.rs b/clippy_lints/src/self_assignment.rs index b14f0518b..af7f5c9b6 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"]