From c0040412b288b790e49e941d5cd2b862018280cc Mon Sep 17 00:00:00 2001 From: Benjamin Woodruff Date: Thu, 19 Dec 2024 20:23:53 -0800 Subject: [PATCH] chore(turbopack): Delete to-resolved-in-loop lint (too low signal) (#74113) Had a discussion with @sokra about this during office hours. We were in agreement to delete this, not because it's usually wrong, but just because it's not high-signal enough: - Many instances of `to_resolved().await` are on simple constructor calls, so it doesn't really matter if they're sequential. We could add some heuristics for this, but they'd be imperfect. - `to_resolved().await` isn't actually what drives the work forward, it's the function call that schedules the work, so in some cases this isn't accurate (and you can't know without type information). - This would make more sense if we were typically starved for work, but usually we have more tokio tasks than we can process anyways, so increasing parallelism is unlikely to help in most cases. - Some code isn't performance sensitive (e.g. internal CLI utilities, tests), so this is just noise in those places. --- .../ast-grep/rules/to-resolved-in-loop.yml | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 .config/ast-grep/rules/to-resolved-in-loop.yml diff --git a/.config/ast-grep/rules/to-resolved-in-loop.yml b/.config/ast-grep/rules/to-resolved-in-loop.yml deleted file mode 100644 index 7099720fb78b7..0000000000000 --- a/.config/ast-grep/rules/to-resolved-in-loop.yml +++ /dev/null @@ -1,30 +0,0 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/ast-grep/ast-grep/main/schemas/rule.json - -id: to-resolved-in-loop -message: 'Calling `$EXPR` in a loop could be a doing a lot of work sequentially. Consider producing an iterator of futures and using `try_join`.' -severity: info # error, warning, info, hint -language: Rust -rule: - kind: for_expression - pattern: for $VAR in $ITER {$$$_ARGS} - has: - kind: try_expression - stopBy: end - all: - - pattern: $ARG.to_resolved().await? - - pattern: $EXPR - # ignore sequential application - - not: - inside: - kind: assignment_expression - pattern: '*$VAR = $_EXPR' - # ignore conditionals via match - - not: - inside: - kind: match_arm - stopBy: end - # ignore conditionals via if - - not: - inside: - kind: if_expression - stopBy: end