about summary refs log tree commit diff
path: root/clippy_lints/src/let_underscore.rs
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2023-11-02 17:35:56 +0100
committerPhilipp Krones <hello@philkrones.com>2023-11-02 17:35:56 +0100
commit77c1e3aaa10aa78e7841b03a674acdc22bb6f758 (patch)
tree840e473e53f199f0e49a49c20d2e7c7dcf801828 /clippy_lints/src/let_underscore.rs
parentaae86ccc473aee83059a0bf21db9847bc65a5c37 (diff)
Merge commit '09ac14c901abc43bd0d617ae4a44e8a4fed98d9c' into clippyup
Diffstat (limited to 'clippy_lints/src/let_underscore.rs')
-rw-r--r--clippy_lints/src/let_underscore.rs29
1 files changed, 15 insertions, 14 deletions
diff --git a/clippy_lints/src/let_underscore.rs b/clippy_lints/src/let_underscore.rs
index e7c875ab3a9..04f23a213f2 100644
--- a/clippy_lints/src/let_underscore.rs
+++ b/clippy_lints/src/let_underscore.rs
@@ -17,7 +17,7 @@ declare_clippy_lint! {
     /// expr
     ///
     /// ### Example
-    /// ```rust
+    /// ```no_run
     /// fn f() -> Result<u32, u32> {
     ///     Ok(0)
     /// }
@@ -69,7 +69,7 @@ declare_clippy_lint! {
     /// and ignore the resulting value.
     ///
     /// ### Example
-    /// ```rust
+    /// ```no_run
     /// async fn foo() -> Result<(), ()> {
     ///     Ok(())
     /// }
@@ -77,7 +77,7 @@ declare_clippy_lint! {
     /// ```
     ///
     /// Use instead:
-    /// ```rust
+    /// ```no_run
     /// # async fn context() {
     /// async fn foo() -> Result<(), ()> {
     ///     Ok(())
@@ -107,14 +107,14 @@ declare_clippy_lint! {
     /// lints.
     ///
     /// ### Example
-    /// ```rust
+    /// ```no_run
     /// fn foo() -> Result<u32, ()> {
     ///     Ok(123)
     /// }
     /// let _ = foo();
     /// ```
     /// Use instead:
-    /// ```rust
+    /// ```no_run
     /// fn foo() -> Result<u32, ()> {
     ///     Ok(123)
     /// }
@@ -159,14 +159,15 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
                             binding or dropping explicitly with `std::mem::drop`",
                 );
             } else if let Some(future_trait_def_id) = cx.tcx.lang_items().future_trait()
-                && implements_trait(cx, cx.typeck_results().expr_ty(init), future_trait_def_id, &[]) {
+                && implements_trait(cx, cx.typeck_results().expr_ty(init), future_trait_def_id, &[])
+            {
                 span_lint_and_help(
                     cx,
                     LET_UNDERSCORE_FUTURE,
                     local.span,
                     "non-binding `let` on a future",
                     None,
-                    "consider awaiting the future or dropping explicitly with `std::mem::drop`"
+                    "consider awaiting the future or dropping explicitly with `std::mem::drop`",
                 );
             } else if is_must_use_ty(cx, cx.typeck_results().expr_ty(init)) {
                 span_lint_and_help(
@@ -203,17 +204,17 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
                     return;
                 }
 
-				span_lint_and_help(
+                span_lint_and_help(
                     cx,
                     LET_UNDERSCORE_UNTYPED,
                     local.span,
                     "non-binding `let` without a type annotation",
-                    Some(
-						Span::new(local.pat.span.hi(),
-						local.pat.span.hi() + BytePos(1),
-						local.pat.span.ctxt(),
-						local.pat.span.parent()
-					)),
+                    Some(Span::new(
+                        local.pat.span.hi(),
+                        local.pat.span.hi() + BytePos(1),
+                        local.pat.span.ctxt(),
+                        local.pat.span.parent(),
+                    )),
                     "consider adding a type annotation",
                 );
             }