# no-redundant-full-slice

Disallow indexing a slice with the complete range

Indexing a slice with `..` borrows the complete slice without changing its bounds.
Instead, you SHOULD use the slice directly and let the required access be inferred.

- Category: style
- Level: warning
- Fix: automatic
- Scope: module

## Reported

```ds title="main.ds"
function visit(values: [int32]): void {
    consume(values[..]);
}

function consume(values: &readonly [int32]): void {
    // intentionally empty
}
```

## Accepted

```ds title="main.ds"
function visit(values: [int32]): void {
    consume(values);
}

function consume(values: &readonly [int32]): void {
    // intentionally empty
}
```

## Prior art

- [Clippy · redundant_slicing](https://rust-lang.github.io/rust-clippy/master/index.html#redundant_slicing)

[language/linter/src/rules/style/no_redundant_full_slice.rs:8](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/style/no_redundant_full_slice.rs#L8)
