# no-literal-unwrap

Disallow immediately unwrapping a known successful result variant

Unwrapping a newly constructed successful result returns the payload supplied to its constructor.
Instead, you SHOULD use that payload directly.

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

## Reported

```ds title="main.ds"
function identity(value: int32): int32 {
    return Result<int32, string>.ok(value).unwrap();
}
```

## Accepted

```ds title="main.ds"
function identity(value: int32): int32 {
    return value;
}
```

## Prior art

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

[language/linter/src/rules/style/no_literal_unwrap.rs:7](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/style/no_literal_unwrap.rs#L7)
