about summary refs log tree commit diff
path: root/src/docs/inconsistent_struct_constructor.txt
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2022-11-21 20:34:47 +0100
committerPhilipp Krones <hello@philkrones.com>2022-11-21 20:51:52 +0100
commit46c5a5d234f13dcf4bb4cf4241b2addedbf0be14 (patch)
tree56726625e55224ecb09ed11f509a964507b9c333 /src/docs/inconsistent_struct_constructor.txt
parent3597ed5a099488aa77caf444106a0550b7e5d2e8 (diff)
downloadrust-46c5a5d234f13dcf4bb4cf4241b2addedbf0be14.tar.gz
rust-46c5a5d234f13dcf4bb4cf4241b2addedbf0be14.zip
Merge commit 'f4850f7292efa33759b4f7f9b7621268979e9914' into clippyup
Diffstat (limited to 'src/docs/inconsistent_struct_constructor.txt')
-rw-r--r--src/docs/inconsistent_struct_constructor.txt40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/docs/inconsistent_struct_constructor.txt b/src/docs/inconsistent_struct_constructor.txt
deleted file mode 100644
index eb682109a54..00000000000
--- a/src/docs/inconsistent_struct_constructor.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-### What it does
-Checks for struct constructors where all fields are shorthand and
-the order of the field init shorthand in the constructor is inconsistent
-with the order in the struct definition.
-
-### Why is this bad?
-Since the order of fields in a constructor doesn't affect the
-resulted instance as the below example indicates,
-
-```
-#[derive(Debug, PartialEq, Eq)]
-struct Foo {
-    x: i32,
-    y: i32,
-}
-let x = 1;
-let y = 2;
-
-// This assertion never fails:
-assert_eq!(Foo { x, y }, Foo { y, x });
-```
-
-inconsistent order can be confusing and decreases readability and consistency.
-
-### Example
-```
-struct Foo {
-    x: i32,
-    y: i32,
-}
-let x = 1;
-let y = 2;
-
-Foo { y, x };
-```
-
-Use instead:
-```
-Foo { x, y };
-```
\ No newline at end of file