Rollup merge of #79940 - matthiaskrgr:cl15ppy, r=Dylan-DPC
fix more clippy::complexity findings fix clippy::unnecessary_filter_map use if let Some(x) = .. instead of ...map(|x|) to conditionally run fns that return () (clippy::option_map_unit_fn) fix clippy::{needless_bool, manual_unwrap_or} don't clone types that are copy (clippy::clone_on_copy) don't convert types into identical types with .into() (clippy::useless_conversion) use strip_prefix over slicing (clippy::manual_strip) r? ``@Dylan-DPC``
This commit is contained in:
commit
1b81f08d4c
15 changed files with 70 additions and 86 deletions
|
@ -285,7 +285,7 @@ impl DebugCounters {
|
|||
),
|
||||
};
|
||||
counters
|
||||
.insert(id.into(), DebugCounter::new(counter_kind.clone(), some_block_label))
|
||||
.insert(id, DebugCounter::new(counter_kind.clone(), some_block_label))
|
||||
.expect_none(
|
||||
"attempt to add the same counter_kind to DebugCounters more than once",
|
||||
);
|
||||
|
@ -340,7 +340,7 @@ impl DebugCounters {
|
|||
if self.some_counters.is_some() && (counter_format.block || !counter_format.id) {
|
||||
let counters = self.some_counters.as_ref().unwrap();
|
||||
if let Some(DebugCounter { some_block_label: Some(block_label), .. }) =
|
||||
counters.get(&id.into())
|
||||
counters.get(&id)
|
||||
{
|
||||
return if counter_format.id {
|
||||
format!("{}#{}", block_label, id.index())
|
||||
|
|
|
@ -216,9 +216,10 @@ impl<'a, 'tcx> Helper<'a, 'tcx> {
|
|||
let discr = self.find_switch_discriminant_info(bb, switch)?;
|
||||
|
||||
// go through each target, finding a discriminant read, and a switch
|
||||
let results = discr.targets_with_values.iter().map(|(value, target)| {
|
||||
self.find_discriminant_switch_pairing(&discr, target.clone(), value.clone())
|
||||
});
|
||||
let results = discr
|
||||
.targets_with_values
|
||||
.iter()
|
||||
.map(|(value, target)| self.find_discriminant_switch_pairing(&discr, *target, *value));
|
||||
|
||||
// if the optimization did not apply for one of the targets, then abort
|
||||
if results.clone().any(|x| x.is_none()) || results.len() == 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue