]> git.lizzy.rs Git - rust.git/blob - src/docs/unused_self.txt
Auto merge of #9425 - kraktus:patch-1, r=xFrednet
[rust.git] / src / docs / unused_self.txt
1 ### What it does
2 Checks methods that contain a `self` argument but don't use it
3
4 ### Why is this bad?
5 It may be clearer to define the method as an associated function instead
6 of an instance method if it doesn't require `self`.
7
8 ### Example
9 ```
10 struct A;
11 impl A {
12     fn method(&self) {}
13 }
14 ```
15
16 Could be written:
17
18 ```
19 struct A;
20 impl A {
21     fn method() {}
22 }
23 ```