Rollup merge of #116211 - matthiaskrgr:clippy3, r=compiler-errors

more clippy complextity fixes

redundant_guards, useless_format, clone_on_copy
This commit is contained in:
Matthias Krüger 2023-09-28 09:14:06 +02:00 committed by GitHub
commit fa5b2fe2f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 19 additions and 24 deletions

View file

@ -763,7 +763,7 @@ pub(super) fn filtered_statement_span(statement: &Statement<'_>) -> Option<Span>
// and `_1` is the `Place` for `somenum`.
//
// If and when the Issue is resolved, remove this special case match pattern:
StatementKind::FakeRead(box (cause, _)) if cause == FakeReadCause::ForGuardBinding => None,
StatementKind::FakeRead(box (FakeReadCause::ForGuardBinding, _)) => None,
// Retain spans from all other statements
StatementKind::FakeRead(box (_, _)) // Not including `ForGuardBinding`

View file

@ -54,11 +54,8 @@ impl EnumSizeOpt {
let layout = tcx.layout_of(param_env.and(ty)).ok()?;
let variants = match &layout.variants {
Variants::Single { .. } => return None,
Variants::Multiple { tag_encoding, .. }
if matches!(tag_encoding, TagEncoding::Niche { .. }) =>
{
return None;
}
Variants::Multiple { tag_encoding: TagEncoding::Niche { .. }, .. } => return None,
Variants::Multiple { variants, .. } if variants.len() <= 1 => return None,
Variants::Multiple { variants, .. } => variants,
};