diff --git a/src/autofix/fixer.rs b/src/autofix/fixer.rs index cc6f8a4121..8ad61cfc62 100644 --- a/src/autofix/fixer.rs +++ b/src/autofix/fixer.rs @@ -32,9 +32,10 @@ impl Mode { impl From for Mode { fn from(value: bool) -> Self { - match value { - true => Mode::Apply, - false => Mode::None, + if value { + Mode::Apply + } else { + Mode::None } } } diff --git a/src/cache.rs b/src/cache.rs index 14ddcabbb0..d4043d451e 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -63,9 +63,10 @@ impl Mode { impl From for Mode { fn from(value: bool) -> Self { - match value { - true => Mode::ReadWrite, - false => Mode::None, + if value { + Mode::ReadWrite + } else { + Mode::None } } } diff --git a/src/checks.rs b/src/checks.rs index 9c5c693ef5..23e99b41fb 100644 --- a/src/checks.rs +++ b/src/checks.rs @@ -1421,24 +1421,18 @@ impl CheckKind { CheckKind::ExpressionsInStarAssignment => { "Too many expressions in star-unpacking assignment".to_string() } - CheckKind::TrueFalseComparison(value, op) => match *value { - true => match op { - RejectedCmpop::Eq => { - "Comparison to `True` should be `cond is True`".to_string() - } - RejectedCmpop::NotEq => { - "Comparison to `True` should be `cond is not True`".to_string() - } - }, - false => match op { - RejectedCmpop::Eq => { - "Comparison to `False` should be `cond is False`".to_string() - } - RejectedCmpop::NotEq => { - "Comparison to `False` should be `cond is not False`".to_string() - } - }, - }, + CheckKind::TrueFalseComparison(true, RejectedCmpop::Eq) => { + "Comparison to `True` should be `cond is True`".to_string() + } + CheckKind::TrueFalseComparison(true, RejectedCmpop::NotEq) => { + "Comparison to `True` should be `cond is not True`".to_string() + } + CheckKind::TrueFalseComparison(false, RejectedCmpop::Eq) => { + "Comparison to `False` should be `cond is False`".to_string() + } + CheckKind::TrueFalseComparison(false, RejectedCmpop::NotEq) => { + "Comparison to `False` should be `cond is not False`".to_string() + } CheckKind::TwoStarredExpressions => "Two starred expressions in assignment".to_string(), CheckKind::TypeComparison => "Do not compare types, use `isinstance()`".to_string(), CheckKind::UndefinedExport(name) => {