---
title: "lint/complexity/no-redundant-literal-return"
pagination: false
---

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

<RuleId id="lint/complexity/no-redundant-literal-return" />

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

## What it does

Detects redundant literal guard patterns where an if statement checks if a variable equals a literal and returns that same literal, followed by returning the variable.

## Configuration

```toml title="pun.toml"
[lint.rules]
"complexity/no-redundant-literal-return" = "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

- [`Pun/no_redundant_literal_return`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/) (pun)
- [`no-redundant-literal-return`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#no-redundant-literal-return) (mago-linter)

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