---
title: "simplify-range"
description: "Simplify range statements and avoid unnecessary rune slices."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# simplify-range

Simplify range statements and remove allocations that do not change
the yielded values.

**Default severity:** `warning`

## Behavior

The rule omits explicit blank range values and reports `range []rune(text)`
when the index is discarded. Ranging directly over the string yields the same
runes without allocating a slice. When the index is used, the conversion is
preserved because a string range yields byte offsets while a rune-slice range
yields rune indexes.

## Bad

```go
for _, character := range []rune(text) {
	use(character)
}

for _, _ = range values {
	use(values)
}
```

## Good

```go
for _, character := range text {
	use(character)
}

for range values {
	use(values)
}
```

Source: https://strider.gempir.com/lints/simplify-range/index.mdx
