diff options
| author | relrelb <relrelbachar@gmail.com> | 2022-08-16 23:26:03 +0300 |
|---|---|---|
| committer | relrelb <relrelbachar@gmail.com> | 2022-09-04 23:43:17 +0300 |
| commit | f0e586c2511019a58ad3e56be16bba76dfc7eba8 (patch) | |
| tree | 485366dcfe9af1ae54b5afcadcea8324d07eb6da /src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs | |
| parent | 90804d35fef4d90bfa6e2f03696085f872513fa0 (diff) | |
| download | rust-f0e586c2511019a58ad3e56be16bba76dfc7eba8.tar.gz rust-f0e586c2511019a58ad3e56be16bba76dfc7eba8.zip | |
Suggest `Entry::or_default` for `Entry::or_insert(Default::default())`
Unlike past similar work done in #6228, expand the existing `or_fun_call` lint to detect `or_insert` calls with a `T::new()` or `T::default()` argument, much like currently done for `unwrap_or` calls. In that case, suggest the use of `or_default`, which is more idiomatic. Note that even with this change, `or_insert_with(T::default)` calls aren't detected as candidates for `or_default()`, in the same manner that currently `unwrap_or_else(T::default)` calls aren't detected as candidates for `unwrap_or_default()`. Also, as a nearby cleanup, change `KNOW_TYPES` from `static` to `const`, since as far as I understand it's preferred (should Clippy have a lint for that?). Fixes #3812.
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs')
0 files changed, 0 insertions, 0 deletions
