summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/unused_unit.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/unused_unit.txt')
-rw-r--r--src/tools/clippy/src/docs/unused_unit.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/unused_unit.txt b/src/tools/clippy/src/docs/unused_unit.txt
new file mode 100644
index 000000000..48d16ca65
--- /dev/null
+++ b/src/tools/clippy/src/docs/unused_unit.txt
@@ -0,0 +1,18 @@
+### What it does
+Checks for unit (`()`) expressions that can be removed.
+
+### Why is this bad?
+Such expressions add no value, but can make the code
+less readable. Depending on formatting they can make a `break` or `return`
+statement look like a function call.
+
+### Example
+```
+fn return_unit() -> () {
+ ()
+}
+```
+is equivalent to
+```
+fn return_unit() {}
+``` \ No newline at end of file