diff options
Diffstat (limited to 'src/tools/clippy/src/docs/default_instead_of_iter_empty.txt')
-rw-r--r-- | src/tools/clippy/src/docs/default_instead_of_iter_empty.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/default_instead_of_iter_empty.txt b/src/tools/clippy/src/docs/default_instead_of_iter_empty.txt new file mode 100644 index 000000000..b63ef3d18 --- /dev/null +++ b/src/tools/clippy/src/docs/default_instead_of_iter_empty.txt @@ -0,0 +1,15 @@ +### What it does +It checks for `std::iter::Empty::default()` and suggests replacing it with +`std::iter::empty()`. +### Why is this bad? +`std::iter::empty()` is the more idiomatic way. +### Example +``` +let _ = std::iter::Empty::<usize>::default(); +let iter: std::iter::Empty<usize> = std::iter::Empty::default(); +``` +Use instead: +``` +let _ = std::iter::empty::<usize>(); +let iter: std::iter::Empty<usize> = std::iter::empty(); +```
\ No newline at end of file |