# wrong-receiver-convention

Require receiver forms matching the method's name convention

Method prefixes communicate whether an operation borrows, mutates, or consumes its receiver.
Instead, `as` methods SHOULD borrow, `into` methods SHOULD consume, `from` methods SHOULD be static, and `toMut` methods SHOULD borrow with mutable access.

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

## Reported

```ds title="main.ds"
struct Buffer {
    intoBytes(&readonly this): [uint8] {
        todo("Buffer.intoBytes")
    }
}
```

## Accepted

```ds title="main.ds"
struct Buffer {
    intoBytes(this): [uint8] {
        todo("Buffer.intoBytes")
    }
}
```

## Prior art

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

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