]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/let_underscore.rs
Auto merge of #9148 - arieluy:then_some_unwrap_or, r=Jarcho
[rust.git] / clippy_lints / src / let_underscore.rs
index cb1ef01f5ba9da535914e20717219b40ef8c33af..176787497ebf2e655f93ba77b15e1c41436aa87a 100644 (file)
     /// `std::mem::drop` conveys your intention better and is less error-prone.
     ///
     /// ### Example
-    ///
-    /// Bad:
     /// ```rust,ignore
     /// let _ = mutex.lock();
     /// ```
     ///
-    /// Good:
+    /// Use instead:
     /// ```rust,ignore
     /// let _lock = mutex.lock();
     /// ```
     /// better and is less error-prone.
     ///
     /// ### Example
-    ///
-    /// Bad:
-    /// ```rust,ignore
-    /// struct Droppable;
-    /// impl Drop for Droppable {
-    ///     fn drop(&mut self) {}
-    /// }
+    /// ```rust
+    /// # struct DroppableItem;
     /// {
-    ///     let _ = Droppable;
-    ///     //               ^ dropped here
+    ///     let _ = DroppableItem;
+    ///     //                   ^ dropped here
     ///     /* more code */
     /// }
     /// ```
     ///
-    /// Good:
-    /// ```rust,ignore
+    /// Use instead:
+    /// ```rust
+    /// # struct DroppableItem;
     /// {
-    ///     let _droppable = Droppable;
+    ///     let _droppable = DroppableItem;
     ///     /* more code */
     ///     // dropped at end of scope
     /// }
 
 declare_lint_pass!(LetUnderscore => [LET_UNDERSCORE_MUST_USE, LET_UNDERSCORE_LOCK, LET_UNDERSCORE_DROP]);
 
-const SYNC_GUARD_PATHS: [&[&str]; 5] = [
+const SYNC_GUARD_PATHS: [&[&str]; 6] = [
     &paths::MUTEX_GUARD,
     &paths::RWLOCK_READ_GUARD,
     &paths::RWLOCK_WRITE_GUARD,
-    &paths::PARKING_LOT_RAWMUTEX,
-    &paths::PARKING_LOT_RAWRWLOCK,
+    &paths::PARKING_LOT_MUTEX_GUARD,
+    &paths::PARKING_LOT_RWLOCK_READ_GUARD,
+    &paths::PARKING_LOT_RWLOCK_WRITE_GUARD,
 ];
 
 impl<'tcx> LateLintPass<'tcx> for LetUnderscore {