Skip to content

Commit 94b6272

Browse files
committed
Simplify some logic
1 parent 1575385 commit 94b6272

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

chalk-solve/src/clauses/builtin_traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::{builder::ClauseBuilder, generalize};
22
use crate::{Interner, RustIrDatabase, TraitRef, WellKnownTrait};
3-
use chalk_ir::{ProjectionTy, Substitution, Ty, AliasTy};
3+
use chalk_ir::{AliasTy, ProjectionTy, Substitution, Ty};
44

55
mod clone;
66
mod copy;

chalk-solve/src/clauses/builtin_traits/fn_family.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ pub fn add_fn_trait_program_clauses<I: Interner>(
6363
let fn_once = db.trait_datum(trait_id);
6464
assert_eq!(fn_once.well_known, Some(WellKnownTrait::FnOnce));
6565
let assoc_types = &fn_once.associated_ty_ids;
66-
if assoc_types.len() != 1 {
67-
panic!(
68-
"FnOnce trait should have exactly one associated type, found {:?}",
69-
assoc_types
70-
);
71-
}
66+
assert_eq!(
67+
assoc_types.len(),
68+
1,
69+
"FnOnce trait should have exactly one associated type, found {:?}",
70+
assoc_types
71+
);
7272

7373
// Construct `Normalize(<fn(A) -> B as FnOnce<(A,)>>::Output -> B)`
7474
let assoc_output_ty = assoc_types[0];
@@ -81,7 +81,7 @@ pub fn add_fn_trait_program_clauses<I: Interner>(
8181
ty: fn_output_ty.clone(),
8282
};
8383

84-
this.push_clause(normalize, std::iter::once(inner_trait));
84+
this.push_fact(normalize);
8585
}
8686
});
8787
}

0 commit comments

Comments
 (0)