---
title: "lint/dead-code/no-unused-expression"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/dead-code/no-unused-expression" />

In the [`dead-code`](/docs/rules/sets/dead-code) set. Safe fix.

## What it does

Remove dead code statements

## Configuration

```toml title="pun.toml"
[lint.rules]
"dead-code/no-unused-expression" = "error"
```

To skip it in some files or lines, add an [override](/docs/configuration/pun-toml#lint) or an [ignore comment](/docs/configuration/ignore-comments).

## Replaces

- [`RemoveDeadStmt`](https://getrector.com/rule-detail/remove-dead-stmt-rector) (rector)
- [`NoopRule`](https://phpstan.org/error-identifiers/booleanAnd.resultUnused) (phpstan-classes)
- [`UnusedFunctionCall`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`UnusedMethodCall`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`UnusedStatement`](https://mago.carthage.software/1.61.0/en/tools/analyzer/overview/) (mago-analyzer)
- [`booleanAnd.resultUnused`](https://phpstan.org/error-identifiers/booleanAnd.resultUnused) (phpstan)
- [`booleanOr.resultUnused`](https://phpstan.org/error-identifiers/booleanOr.resultUnused) (phpstan)
- [`expr.resultUnused`](https://phpstan.org/error-identifiers/expr.resultUnused) (phpstan)
- [`logicalAnd.resultUnused`](https://phpstan.org/error-identifiers/logicalAnd.resultUnused) (phpstan)
- [`logicalOr.resultUnused`](https://phpstan.org/error-identifiers/logicalOr.resultUnused) (phpstan)
- [`logicalXor.resultUnused`](https://phpstan.org/error-identifiers/logicalXor.resultUnused) (phpstan)
- [`ternary.resultUnused`](https://phpstan.org/error-identifiers/ternary.resultUnused) (phpstan)

[More lint/dead-code rules](/docs/rules/lint/dead-code) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
