about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-09-05 04:54:31 +0000
committerbors <bors@rust-lang.org>2022-09-05 04:54:31 +0000
commitb763b14b2fa29d5b05373317606f27fdb9053302 (patch)
tree485366dcfe9af1ae54b5afcadcea8324d07eb6da /src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs
parent90804d35fef4d90bfa6e2f03696085f872513fa0 (diff)
parentf0e586c2511019a58ad3e56be16bba76dfc7eba8 (diff)
downloadrust-b763b14b2fa29d5b05373317606f27fdb9053302.tar.gz
rust-b763b14b2fa29d5b05373317606f27fdb9053302.zip
Auto merge of #9342 - relrelb:or_default, r=dswij
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?).

Addresses #3812.

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`or_fun_call`]: Suggest `Entry::or_default` for `Entry::or_insert(Default::default())`
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs')
0 files changed, 0 insertions, 0 deletions