]> git.lizzy.rs Git - rust.git/blob - src/docs/default_trait_access.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / default_trait_access.txt
1 ### What it does
2 Checks for literal calls to `Default::default()`.
3
4 ### Why is this bad?
5 It's easier for the reader if the name of the type is used, rather than the
6 generic `Default`.
7
8 ### Example
9 ```
10 let s: String = Default::default();
11 ```
12
13 Use instead:
14 ```
15 let s = String::default();
16 ```