From a7dec1ba253fc4f125b942450b7de352bd6712d6 Mon Sep 17 00:00:00 2001 From: David Barsky Date: Thu, 16 Nov 2023 07:31:54 -0800 Subject: [PATCH] clippy: prevent holding a span guard over an `.await` Summary: X-link: https://github.com/facebookresearch/Private-ID/pull/119 We should probably lint against using an `.enter()` guard over `.await` points for the reasons outlined in https://docs.rs/tracing/latest/tracing/struct.Span.html#in-asynchronous-code. Reviewed By: zertosh Differential Revision: D50528695 fbshipit-source-id: 82fcc97a83b5d820c8673e6f56794dc47fd4d77f --- tools/rust/ossconfigs/clippy.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/rust/ossconfigs/clippy.toml b/tools/rust/ossconfigs/clippy.toml index f5522e6..3c34d52 100644 --- a/tools/rust/ossconfigs/clippy.toml +++ b/tools/rust/ossconfigs/clippy.toml @@ -1 +1,5 @@ too-many-lines-threshold = 200 +await-holding-invalid-types = [ + { path = "tracing::span::Entered", reason = "`Entered` is not aware when a function is suspended: https://docs.rs/tracing/latest/tracing/struct.Span.html#in-asynchronous-code" }, + { path = "tracing::span::EnteredSpan", reason = "`EnteredSpan` is not aware when a function is suspended: https://docs.rs/tracing/latest/tracing/struct.Span.html#in-asynchronous-code" }, +]