Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburns committed Oct 18, 2023
1 parent 92133e7 commit fd61962
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ pub trait LayoutTree {
fn compute_child_layout(&mut self, node_id: NodeId, inputs: LayoutInput) -> LayoutOutput;
}

/// A private trait which allows us to add extra convenience methods to types which implement
/// LayoutTree without making those methods public.
pub(crate) trait LayoutTreeExt: LayoutTree {
/// Compute the size of the node given the specified constraints
#[inline(always)]
Expand Down
7 changes: 5 additions & 2 deletions src/tree/taffy_tree/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,14 @@ where
inputs,
style,
Some(|known_dimensions, available_space| {
(&mut self.measure_function)(known_dimensions, available_space, node, node_context)
(self.measure_function)(known_dimensions, available_space, node, node_context)
}),
)
} else {
let measure_function: Option<fn(Size<Option<f32>>, Size<AvailableSpace>) -> Size<f32>> = None;
/// Type inference gets confused because we're just passing None here. So we give
/// it a concrete type to work with (even though we never construct the inner type)
type DummyMeasureFunction = Option<fn(Size<Option<f32>>, Size<AvailableSpace>) -> Size<f32>>;
let measure_function: DummyMeasureFunction = None;
compute_leaf_layout(inputs, style, measure_function)
}
}
Expand Down

0 comments on commit fd61962

Please sign in to comment.