Another batch of fixups

This commit is contained in:
Piotr Osiewicz 2024-01-02 00:24:11 +01:00
parent 2621efebea
commit a3759f9a33
3 changed files with 6 additions and 10 deletions

View file

@ -85,9 +85,7 @@ pub fn derive_refineable(input: TokenStream) -> TokenStream {
// Append to where_clause or create a new one if it doesn't exist
let where_clause = match where_clause.cloned() {
Some(mut where_clause) => {
where_clause
.predicates
.extend(type_param_bounds.into_iter());
where_clause.predicates.extend(type_param_bounds);
where_clause.clone()
}
None => WhereClause {

View file

@ -27,7 +27,7 @@ pub struct CascadeSlot(usize);
impl<S: Refineable + Default> Cascade<S> {
pub fn reserve(&mut self) -> CascadeSlot {
self.0.push(None);
return CascadeSlot(self.0.len() - 1);
CascadeSlot(self.0.len() - 1)
}
pub fn base(&mut self) -> &mut S::Refinement {
@ -40,10 +40,8 @@ impl<S: Refineable + Default> Cascade<S> {
pub fn merged(&self) -> S::Refinement {
let mut merged = self.0[0].clone().unwrap();
for refinement in self.0.iter().skip(1) {
if let Some(refinement) = refinement {
merged.refine(refinement);
}
for refinement in self.0.iter().skip(1).flatten() {
merged.refine(refinement);
}
merged
}