codemod(turbopack): Inline trivial uses of `let this = self` (#70431)
A follow-up to the #70431 codemod diff, which leave behind a lot of
trivial `let this = self;` statements.
Using the following ast-grep rule config:
```yaml
language: rust
id: inline_trivial_this
utils:
block-with-this:
all:
- pattern: $BLOCK
- kind: block
- has:
all:
- pattern: let this = $SELF;
- any:
- pattern: let this = self;
- pattern: let this = &self.0;
rule:
matches: block-with-this
rewriters:
- id: remove-let-this
rule:
pattern: let this = $SELF;
fix: ""
- id: inline-this-auto-deref
rule:
pattern: this
inside:
kind: field_expression
transform:
SELF_AUTO_DEREF:
replace:
source: $SELF
replace: "&?(?<INNER>.*)"
by: "$INNER"
fix: $SELF_AUTO_DEREF
- id: inline-this
rule:
pattern: this
fix: $SELF
transform:
NEW_BLOCK:
rewrite:
source: $BLOCK
rewriters:
- remove-let-this
- inline-this-auto-deref
- inline-this
fix:
$NEW_BLOCK
```
Applied with
```
sg scan -U -r ../codemod_inline_trivial_this.yml .
```