about summary refs log tree commit diff
path: root/src/docs/should_implement_trait.txt
blob: 02e74751ae034ee573789f03b41b6cd4c176f0ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
### What it does
Checks for methods that should live in a trait
implementation of a `std` trait (see [llogiq's blog
post](http://llogiq.github.io/2015/07/30/traits.html) for further
information) instead of an inherent implementation.

### Why is this bad?
Implementing the traits improve ergonomics for users of
the code, often with very little cost. Also people seeing a `mul(...)`
method
may expect `*` to work equally, so you should have good reason to disappoint
them.

### Example
```
struct X;
impl X {
    fn add(&self, other: &X) -> X {
        // ..
    }
}
```