From 62eb4e7d7b5568bfcf9e82a61bf3a60aaa739548 Mon Sep 17 00:00:00 2001 From: MarcusGrass Date: Thu, 1 Jun 2023 15:53:20 +0200 Subject: [PATCH 1/2] Bring up Rust lang #37612 as a known problem for let_and_return --- clippy_lints/src/returns.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index 631ecf1428d6..92913ddc4aa5 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -25,6 +25,12 @@ declare_clippy_lint! { /// It is just extraneous code. Remove it to make your code /// more rusty. /// + /// ### Known problems + /// In the case of some temporaries, e.g. locks, eliding the variable binding could lead + /// to deadlocks. See [rust-lang issue 37612](https://github.com/rust-lang/rust/issues/37612). + /// This could become relevant if the code is later changed to use the code that would have been + /// bound without first assigning it to a let-binding. + /// /// ### Example /// ```rust /// fn foo() -> String { From 6f2497703e7e3b7c4c0c007371ed6870c984769a Mon Sep 17 00:00:00 2001 From: MarcusGrass <34198073+MarcusGrass@users.noreply.github.com> Date: Mon, 5 Jun 2023 15:48:57 +0200 Subject: [PATCH 2/2] Compact issue link Co-authored-by: Takayuki Nakata --- clippy_lints/src/returns.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index 92913ddc4aa5..b5686e390ad5 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -27,7 +27,7 @@ declare_clippy_lint! { /// /// ### Known problems /// In the case of some temporaries, e.g. locks, eliding the variable binding could lead - /// to deadlocks. See [rust-lang issue 37612](https://github.com/rust-lang/rust/issues/37612). + /// to deadlocks. See [this issue](https://github.com/rust-lang/rust/issues/37612). /// This could become relevant if the code is later changed to use the code that would have been /// bound without first assigning it to a let-binding. ///