summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/needless_arbitrary_self_type.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/needless_arbitrary_self_type.txt')
-rw-r--r--src/tools/clippy/src/docs/needless_arbitrary_self_type.txt44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/needless_arbitrary_self_type.txt b/src/tools/clippy/src/docs/needless_arbitrary_self_type.txt
new file mode 100644
index 000000000..8216a3a3f
--- /dev/null
+++ b/src/tools/clippy/src/docs/needless_arbitrary_self_type.txt
@@ -0,0 +1,44 @@
+### What it does
+The lint checks for `self` in fn parameters that
+specify the `Self`-type explicitly
+### Why is this bad?
+Increases the amount and decreases the readability of code
+
+### Example
+```
+enum ValType {
+ I32,
+ I64,
+ F32,
+ F64,
+}
+
+impl ValType {
+ pub fn bytes(self: Self) -> usize {
+ match self {
+ Self::I32 | Self::F32 => 4,
+ Self::I64 | Self::F64 => 8,
+ }
+ }
+}
+```
+
+Could be rewritten as
+
+```
+enum ValType {
+ I32,
+ I64,
+ F32,
+ F64,
+}
+
+impl ValType {
+ pub fn bytes(self) -> usize {
+ match self {
+ Self::I32 | Self::F32 => 4,
+ Self::I64 | Self::F64 => 8,
+ }
+ }
+}
+``` \ No newline at end of file