]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/src/docs/missing_trait_methods.txt
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / src / docs / missing_trait_methods.txt
1 ### What it does
2 Checks if a provided method is used implicitly by a trait
3 implementation. A usage example would be a wrapper where every method
4 should perform some operation before delegating to the inner type's
5 implemenation.
6
7 This lint should typically be enabled on a specific trait `impl` item
8 rather than globally.
9
10 ### Why is this bad?
11 Indicates that a method is missing.
12
13 ### Example
14 ```
15 trait Trait {
16 fn required();
17
18 fn provided() {}
19 }
20
21 #[warn(clippy::missing_trait_methods)]
22 impl Trait for Type {
23 fn required() { /* ... */ }
24 }
25 ```
26 Use instead:
27 ```
28 trait Trait {
29 fn required();
30
31 fn provided() {}
32 }
33
34 #[warn(clippy::missing_trait_methods)]
35 impl Trait for Type {
36 fn required() { /* ... */ }
37
38 fn provided() { /* ... */ }
39 }
40 ```