mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
There are unfortunately a few false-positives, because this isn't aware of type information of course.
21 lines
728 B
YAML
21 lines
728 B
YAML
# yaml-language-server: $schema=https://raw.githubusercontent.com/ast-grep/ast-grep/main/schemas/rule.json
|
|
|
|
id: no-context-format
|
|
message: Use `.with_context(|| format!(...))` instead of `.context(format!(...))`.
|
|
note: >
|
|
`.context(format!(...))` eagerly allocates the formatted string even when there is no error.
|
|
Use `.with_context(|| format!(...))` for lazy evaluation.
|
|
severity: error
|
|
language: Rust
|
|
rule:
|
|
pattern: $OBJ.context(format!($$$ARGS))
|
|
fix: $OBJ.with_context(|| format!($$$ARGS))
|
|
---
|
|
id: no-context-turbofmt
|
|
message: >
|
|
`.context(turbofmt!(...).await?)` eagerly creates the formatted string even when there is no error.
|
|
severity: error
|
|
language: Rust
|
|
rule:
|
|
pattern: $OBJ.context(turbofmt!($$$ARGS).await?)
|