From a40ad1ea4d7f0db12ee5ee8ebc5539516b59fd60 Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Tue, 26 Aug 2025 11:52:18 +0200 Subject: [PATCH] meta(cursor): Add rule to avoid explicit type annotations I have noticed that Cursor often adds type annotations, especially in `let` statements, even when they are not needed. This typically occurs with generics, which sadly cannot be linted by [clippy::redundant_type_annotations](https://rust-lang.github.io/rust-clippy/master/index.html#redundant_type_annotations), so I have instead decided to add a Cursor rule to hopefully prevent this behavior going forward --- .cursor/rules/rust-development.mdc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.cursor/rules/rust-development.mdc b/.cursor/rules/rust-development.mdc index 53ec5b779b..b10650e43a 100644 --- a/.cursor/rules/rust-development.mdc +++ b/.cursor/rules/rust-development.mdc @@ -21,6 +21,12 @@ alwaysApply: false - Match existing code style and naming conventions - Add appropriate logging using `log` crate patterns +## Type Annotations and Inference + +- Prefer compiler type inference across the codebase +- Do not add explicit type annotations in `let` bindings or turbofish syntax (e.g., `::`) unless required for the code to compile or to disambiguate an API that inference cannot resolve +- If the code compiles without explicit annotations, omit them + ## Development Commands ```bash