summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/needless_doctest_main.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/needless_doctest_main.txt')
-rw-r--r--src/tools/clippy/src/docs/needless_doctest_main.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/needless_doctest_main.txt b/src/tools/clippy/src/docs/needless_doctest_main.txt
new file mode 100644
index 000000000..8f91a7baa
--- /dev/null
+++ b/src/tools/clippy/src/docs/needless_doctest_main.txt
@@ -0,0 +1,22 @@
+### What it does
+Checks for `fn main() { .. }` in doctests
+
+### Why is this bad?
+The test can be shorter (and likely more readable)
+if the `fn main()` is left implicit.
+
+### Examples
+```
+/// An example of a doctest with a `main()` function
+///
+/// # Examples
+///
+/// ```
+/// fn main() {
+/// // this needs not be in an `fn`
+/// }
+/// ```
+fn needless_main() {
+ unimplemented!();
+}
+``` \ No newline at end of file