diff --git a/Cargo.toml b/Cargo.toml
index e72b9d63c..271404b3e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,12 +16,12 @@ circle-ci = { repository = "vislyhq/stretch", branch = "master" }
maintenance = { status = "experimental" }
[dependencies]
-hashbrown = "0.6.0"
-lazy_static = "1.3"
+hashbrown = "0.6.3"
+lazy_static = "1.4"
spin = "0.5.2"
[dependencies.serde]
-version = "1.0.99"
+version = "1.0.102"
features = ["serde_derive"]
optional = true
@@ -32,7 +32,7 @@ serde_camel_case = ["serde"]
serde_kebab_case = ["serde"]
[dev-dependencies]
-criterion = "0.2"
+criterion = "0.3.0"
[profile.release]
lto = true
diff --git a/scripts/gentest/Cargo.toml b/scripts/gentest/Cargo.toml
index 83573f292..c639330fc 100644
--- a/scripts/gentest/Cargo.toml
+++ b/scripts/gentest/Cargo.toml
@@ -5,15 +5,15 @@ authors = ["Emil Sjölander <emil@visly.app>"]
edition = "2018"
[dependencies]
-env_logger = "0.6"
+env_logger = "0.7.1"
failure = "0.1"
-fantoccini = "0.11.7"
+fantoccini = "0.11.9"
futures = "0.1"
-indicatif = "0.11"
-json = "0.11.13"
+indicatif = "0.13.0"
+json = "0.12.0"
log = "0.4"
-proc-macro2 = "0.4"
-quote = "0.6"
+proc-macro2 = "1.0.6"
+quote = "1.0.2"
serde_json = "1"
-syn = "0.15"
+syn = "1.0.7"
tokio = "0.1"
diff --git a/src/algo.rs b/src/algo.rs
index d4bde363f..cb902d15f 100644
--- a/src/algo.rs
+++ b/src/algo.rs
@@ -110,7 +110,7 @@ impl Forest {
Ok(())
}
- fn round_layout(nodes: &mut Vec<NodeData>, children: &Vec<Vec<NodeId>>, root: NodeId, abs_x: f32, abs_y: f32) {
+ fn round_layout(nodes: &mut Vec<NodeData>, children: &[Vec<NodeId>], root: NodeId, abs_x: f32, abs_y: f32) {
let layout = &mut nodes[root].layout;
let abs_x = abs_x + layout.location.x;
let abs_y = abs_y + layout.location.y;
@@ -124,6 +124,7 @@ impl Forest {
}
}
+ #[allow(clippy::cognitive_complexity)]
fn compute_internal(
&mut self,
node: NodeId,
@@ -268,9 +269,9 @@ impl Forest {
})
.collect();
- let has_baseline_child = flex_items.iter().fold(false, |result, child| {
- result || self.nodes[child.node].style.align_self(&self.nodes[node].style) == AlignSelf::Baseline
- });
+ let has_baseline_child = flex_items
+ .iter()
+ .any(|child| self.nodes[child.node].style.align_self(&self.nodes[node].style) == AlignSelf::Baseline);
// TODO - this does not follow spec. See commented out code below
// 3. Determine the flex base size and hypothetical main size of each item:
@@ -1340,7 +1341,7 @@ impl Forest {
}
}
- fn hidden_layout(nodes: &mut Vec<NodeData>, children: &Vec<Vec<NodeId>>, node: NodeId, order: u32) {
+ fn hidden_layout(nodes: &mut Vec<NodeData>, children: &[Vec<NodeId>], node: NodeId, order: u32) {
nodes[node].layout =
result::Layout { order, size: Size { width: 0.0, height: 0.0 }, location: Point { x: 0.0, y: 0.0 } };
diff --git a/src/forest.rs b/src/forest.rs
index 06422c805..fd5e542d8 100644
--- a/src/forest.rs
+++ b/src/forest.rs
@@ -116,7 +116,7 @@ impl Forest {
let last = self.nodes.len();
- return if last != node {
+ if last != node {
// Update ids for every child of the swapped in node.
for child in &self.children[last] {
for parent in &mut self.parents[*child] {
@@ -143,7 +143,7 @@ impl Forest {
self.children.swap_remove(node);
self.parents.swap_remove(node);
None
- };
+ }
}
pub unsafe fn remove_child(&mut self, node: NodeId, child: NodeId) -> NodeId {
@@ -159,7 +159,7 @@ impl Forest {
}
pub fn mark_dirty(&mut self, node: NodeId) {
- fn mark_dirty_impl(nodes: &mut Vec<NodeData>, parents: &Vec<Vec<NodeId>>, node_id: NodeId) {
+ fn mark_dirty_impl(nodes: &mut Vec<NodeData>, parents: &[Vec<NodeId>], node_id: NodeId) {
let node = &mut nodes[node_id];
node.layout_cache = None;
node.is_dirty = true;
diff --git a/src/node.rs b/src/node.rs
index 2a101749c..fb40d0b9f 100644
--- a/src/node.rs
+++ b/src/node.rs
@@ -37,11 +37,15 @@ pub struct Stretch {
forest: Forest,
}
-impl Stretch {
- const DEFAULT_CAPACITY: usize = 16;
+impl Default for Stretch {
+ fn default() -> Self {
+ Stretch::with_capacity(16)
+ }
+}
+impl Stretch {
pub fn new() -> Self {
- Self::with_capacity(Self::DEFAULT_CAPACITY)
+ Default::default()
}
pub fn with_capacity(capacity: usize) -> Self {