redundant_pattern_matching

This commit is contained in:
Johann Hemmann 2024-01-19 16:51:08 +01:00
parent 5a62a0db46
commit 71d4dba960
17 changed files with 39 additions and 46 deletions

View file

@ -1043,7 +1043,7 @@ impl HirDisplay for Ty {
f.start_location_link(t.into());
}
write!(f, "Future")?;
if let Some(_) = future_trait {
if future_trait.is_some() {
f.end_location_link();
}
write!(f, "<")?;
@ -1051,7 +1051,7 @@ impl HirDisplay for Ty {
f.start_location_link(t.into());
}
write!(f, "Output")?;
if let Some(_) = output {
if output.is_some() {
f.end_location_link();
}
write!(f, " = ")?;
@ -1520,7 +1520,7 @@ fn write_bounds_like_dyn_trait(
}
write!(f, "Sized")?;
}
if let Some(_) = sized_trait {
if sized_trait.is_some() {
f.end_location_link();
}
}

View file

@ -439,7 +439,7 @@ impl InferenceContext<'_> {
ty
}
&Expr::Continue { label } => {
if let None = find_continuable(&mut self.breakables, label) {
if find_continuable(&mut self.breakables, label).is_none() {
self.push_diagnostic(InferenceDiagnostic::BreakOutsideOfLoop {
expr: tgt_expr,
is_break: false,

View file

@ -1335,7 +1335,7 @@ fn named_associated_type_shorthand_candidates<R>(
),
_ => None,
});
if let Some(_) = res {
if res.is_some() {
return res;
}
// Handle `Self::Type` referring to own associated type in trait definitions

View file

@ -2217,7 +2217,7 @@ impl Evaluator<'_> {
let generic_args = generic_args.clone();
match def {
CallableDefId::FunctionId(def) => {
if let Some(_) = self.detect_fn_trait(def) {
if self.detect_fn_trait(def).is_some() {
return self.exec_fn_trait(
def,
args,