about summary refs log tree commit diff
path: root/src/docs/let_underscore_drop.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/docs/let_underscore_drop.txt')
-rw-r--r--src/docs/let_underscore_drop.txt29
1 files changed, 0 insertions, 29 deletions
diff --git a/src/docs/let_underscore_drop.txt b/src/docs/let_underscore_drop.txt
deleted file mode 100644
index 29ce9bf50ce..00000000000
--- a/src/docs/let_underscore_drop.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-### What it does
-Checks for `let _ = <expr>`
-where expr has a type that implements `Drop`
-
-### Why is this bad?
-This statement immediately drops the initializer
-expression instead of extending its lifetime to the end of the scope, which
-is often not intended. To extend the expression's lifetime to the end of the
-scope, use an underscore-prefixed name instead (i.e. _var). If you want to
-explicitly drop the expression, `std::mem::drop` conveys your intention
-better and is less error-prone.
-
-### Example
-```
-{
-    let _ = DroppableItem;
-    //                   ^ dropped here
-    /* more code */
-}
-```
-
-Use instead:
-```
-{
-    let _droppable = DroppableItem;
-    /* more code */
-    // dropped at end of scope
-}
-```
\ No newline at end of file