Skip to content

Commit cb6dfec

Browse files
committed
Use if let for everything
1 parent 5fd7ffe commit cb6dfec

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed

compiler/rustc_next_trait_solver/src/solve/mod.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,12 @@ where
155155
) -> QueryResult<I> {
156156
// Iterate through all goals in param_env to find the one that has the same symbol.
157157
for pred in param_env.caller_bounds().iter() {
158-
match pred.kind().skip_binder() {
159-
ty::ClauseKind::UnstableFeature(sym) => {
160-
if sym == symbol {
161-
return self
162-
.evaluate_added_goals_and_make_canonical_response(Certainty::Yes);
163-
}
158+
if let ty::ClauseKind::UnstableFeature(sym) = pred.kind().skip_binder() {
159+
if sym == symbol {
160+
return self
161+
.evaluate_added_goals_and_make_canonical_response(Certainty::Yes);
164162
}
165-
_ => {} // don't care
163+
166164
}
167165
}
168166

compiler/rustc_trait_selection/src/traits/fulfill.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -767,13 +767,10 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
767767
ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(symbol)) => {
768768
// Iterate through all goals in param_env to find the one that has the same symbol.
769769
for pred in obligation.param_env.caller_bounds().iter() {
770-
match pred.kind().skip_binder() {
771-
ty::ClauseKind::UnstableFeature(sym) => {
772-
if sym == symbol {
773-
return ProcessResult::Changed(Default::default());
774-
}
770+
if let ty::ClauseKind::UnstableFeature(sym) = pred.kind().skip_binder() {
771+
if sym == symbol {
772+
return ProcessResult::Changed(Default::default());
775773
}
776-
_ => {} // don't care
777774
}
778775
}
779776
// Check if feature is enabled at crate level with #[feature(..)] or if we are currently in codegen.

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -840,13 +840,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
840840

841841
ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(symbol)) => {
842842
for pred in obligation.param_env.caller_bounds().iter() {
843-
match pred.kind().skip_binder() {
844-
ty::ClauseKind::UnstableFeature(sym) => {
845-
if sym == symbol {
846-
return Ok(EvaluatedToOk);
847-
}
843+
if let ty::ClauseKind::UnstableFeature(sym) = pred.kind().skip_binder() {
844+
if sym == symbol {
845+
return Ok(EvaluatedToOk);
848846
}
849-
_ => {} // don't care
850847
}
851848
}
852849
// Check if feature is enabled at crate level with #[feature(..)] or if we are currently in codegen.

0 commit comments

Comments
 (0)