Semantic delta · 10
examples/custom_tree_owned_unsafe.rs
examples/custom_tree_vec.rs
diff --git a/examples/custom_tree_owned_unsafe.rs b/examples/custom_tree_owned_unsafe.rs
index 33641d772..d0138ba95 100644
--- a/examples/custom_tree_owned_unsafe.rs
+++ b/examples/custom_tree_owned_unsafe.rs
@@ -252,8 +252,8 @@ impl taffy::LayoutGridContainer for StatelessLayoutTree {
}
impl RoundTree for StatelessLayoutTree {
- fn get_unrounded_layout(&self, node_id: NodeId) -> &Layout {
- unsafe { &node_from_id_mut(node_id).unrounded_layout }
+ fn get_unrounded_layout(&self, node_id: NodeId) -> Layout {
+ unsafe { node_from_id_mut(node_id).unrounded_layout }
}
fn set_final_layout(&mut self, node_id: NodeId, layout: &Layout) {
@@ -271,8 +271,8 @@ impl PrintTree for StatelessLayoutTree {
}
}
- fn get_final_layout(&self, node_id: NodeId) -> &Layout {
- unsafe { &node_from_id(node_id).final_layout }
+ fn get_final_layout(&self, node_id: NodeId) -> Layout {
+ unsafe { node_from_id(node_id).final_layout }
}
}
diff --git a/examples/custom_tree_vec.rs b/examples/custom_tree_vec.rs
index 539963acf..5659bd174 100644
--- a/examples/custom_tree_vec.rs
+++ b/examples/custom_tree_vec.rs
@@ -260,8 +260,8 @@ impl taffy::LayoutGridContainer for Tree {
}
impl taffy::RoundTree for Tree {
- fn get_unrounded_layout(&self, node_id: NodeId) -> &Layout {
- &self.node_from_id(node_id).unrounded_layout
+ fn get_unrounded_layout(&self, node_id: NodeId) -> Layout {
+ self.node_from_id(node_id).unrounded_layout
}
fn set_final_layout(&mut self, node_id: NodeId, layout: &Layout) {
@@ -279,8 +279,8 @@ impl taffy::PrintTree for Tree {
}
}
- fn get_final_layout(&self, node_id: NodeId) -> &Layout {
- &self.node_from_id(node_id).final_layout
+ fn get_final_layout(&self, node_id: NodeId) -> Layout {
+ self.node_from_id(node_id).final_layout
}
}
diff --git a/src/compute/mod.rs b/src/compute/mod.rs
index c6def929a..aeb5a5f3e 100644
--- a/src/compute/mod.rs
+++ b/src/compute/mod.rs
@@ -209,7 +209,7 @@ pub fn round_layout(tree: &mut impl RoundTree, node_id: NodeId) {
/// Recursive function to apply rounding to all descendents
fn round_layout_inner(tree: &mut impl RoundTree, node_id: NodeId, cumulative_x: f32, cumulative_y: f32) {
- let unrounded_layout = *tree.get_unrounded_layout(node_id);
+ let unrounded_layout = tree.get_unrounded_layout(node_id);
let mut layout = unrounded_layout;
let cumulative_x = cumulative_x + unrounded_layout.location.x;
diff --git a/src/tree/taffy_tree.rs b/src/tree/taffy_tree.rs
index 81e7c98c8..af343aebf 100644
--- a/src/tree/taffy_tree.rs
+++ b/src/tree/taffy_tree.rs
@@ -260,11 +260,11 @@ impl<NodeContext> PrintTree for TaffyTree<NodeContext> {
}
#[inline(always)]
- fn get_final_layout(&self, node_id: NodeId) -> &Layout {
+ fn get_final_layout(&self, node_id: NodeId) -> Layout {
if self.config.use_rounding {
- &self.nodes[node_id.into()].final_layout
+ self.nodes[node_id.into()].final_layout
} else {
- &self.nodes[node_id.into()].unrounded_layout
+ self.nodes[node_id.into()].unrounded_layout
}
}
}
@@ -519,8 +519,8 @@ where
FnMut(Size<Option<f32>>, Size<AvailableSpace>, NodeId, Option<&mut NodeContext>, &Style) -> Size<f32>,
{
#[inline(always)]
- fn get_unrounded_layout(&self, node: NodeId) -> &Layout {
- &self.taffy.nodes[node.into()].unrounded_layout
+ fn get_unrounded_layout(&self, node: NodeId) -> Layout {
+ self.taffy.nodes[node.into()].unrounded_layout
}
#[inline(always)]
diff --git a/src/tree/traits.rs b/src/tree/traits.rs
index cf74ddcdb..d90d1e9e0 100644
--- a/src/tree/traits.rs
+++ b/src/tree/traits.rs
@@ -103,7 +103,7 @@
//! # use taffy::*;
//! pub trait RoundTree: TraverseTree {
//! /// Get the node's unrounded layout
-//! fn get_unrounded_layout(&self, node_id: NodeId) -> &Layout;
+//! fn get_unrounded_layout(&self, node_id: NodeId) -> Layout;
//! /// Get a reference to the node's final layout
//! fn set_final_layout(&mut self, node_id: NodeId, layout: &Layout);
//! }
@@ -122,7 +122,7 @@
//! /// Get a debug label for the node (typically the type of node: flexbox, grid, text, image, etc)
//! fn get_debug_label(&self, node_id: NodeId) -> &'static str;
//! /// Get a reference to the node's final layout
-//! fn get_final_layout(&self, node_id: NodeId) -> &Layout;
+//! fn get_final_layout(&self, node_id: NodeId) -> Layout;
//! }
//! ```
//!
@@ -233,7 +233,7 @@ pub trait CacheTree {
/// As indicated by it's dependence on `TraverseTree`, it required full recursive access to the tree.
pub trait RoundTree: TraverseTree {
/// Get the node's unrounded layout
- fn get_unrounded_layout(&self, node_id: NodeId) -> &Layout;
+ fn get_unrounded_layout(&self, node_id: NodeId) -> Layout;
/// Get a reference to the node's final layout
fn set_final_layout(&mut self, node_id: NodeId, layout: &Layout);
}
@@ -245,7 +245,7 @@ pub trait PrintTree: TraverseTree {
/// Get a debug label for the node (typically the type of node: flexbox, grid, text, image, etc)
fn get_debug_label(&self, node_id: NodeId) -> &'static str;
/// Get a reference to the node's final layout
- fn get_final_layout(&self, node_id: NodeId) -> &Layout;
+ fn get_final_layout(&self, node_id: NodeId) -> Layout;
}
#[cfg(feature = "flexbox")]