diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-10-07 19:28:34 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-10-07 19:28:34 +0200 |
| commit | 13230db68c3cb2842f23f95fc1b47fd989e6277d (patch) | |
| tree | b0bf94a8e3f935a7e9076237783846dee14e3e81 /src/layout | |
| parent | d2e220245d9c17a0ac8c3474984924f65ed6b835 (diff) | |
Fix some clippy warnings ✔
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/nodes/document.rs | 5 | ||||
| -rw-r--r-- | src/layout/nodes/mod.rs | 31 |
2 files changed, 12 insertions, 24 deletions
diff --git a/src/layout/nodes/document.rs b/src/layout/nodes/document.rs index af7a31e6..5c7a2410 100644 --- a/src/layout/nodes/document.rs +++ b/src/layout/nodes/document.rs @@ -7,11 +7,6 @@ pub struct Document { } impl Document { - /// Create a new document. - pub fn new() -> Self { - Self { runs: vec![] } - } - /// Layout the document. pub async fn layout(&self, ctx: &mut LayoutContext) -> Vec<BoxLayout> { let mut layouts = vec![]; diff --git a/src/layout/nodes/mod.rs b/src/layout/nodes/mod.rs index 44c18284..a304e63c 100644 --- a/src/layout/nodes/mod.rs +++ b/src/layout/nodes/mod.rs @@ -75,7 +75,6 @@ impl Layout for LayoutNode { /// /// [`LayoutNode`]: enum.LayoutNode.html /// [Rust Issue]: https://github.com/rust-lang/rust/issues/31740 -#[derive(Clone)] pub struct Dynamic(pub Box<dyn DynNode>); impl Dynamic { @@ -85,12 +84,6 @@ impl Dynamic { } } -impl PartialEq for Dynamic { - fn eq(&self, other: &Self) -> bool { - &self.0 == &other.0 - } -} - impl Deref for Dynamic { type Target = dyn DynNode; @@ -105,6 +98,18 @@ impl Debug for Dynamic { } } +impl Clone for Dynamic { + fn clone(&self) -> Self { + Self(self.0.dyn_clone()) + } +} + +impl PartialEq for Dynamic { + fn eq(&self, other: &Self) -> bool { + self.0.dyn_eq(other.0.as_ref()) + } +} + impl From<Dynamic> for LayoutNode { fn from(dynamic: Dynamic) -> Self { Self::Dyn(dynamic) @@ -153,15 +158,3 @@ where Box::new(self.clone()) } } - -impl Clone for Box<dyn DynNode> { - fn clone(&self) -> Self { - self.dyn_clone() - } -} - -impl PartialEq for Box<dyn DynNode> { - fn eq(&self, other: &Self) -> bool { - self.dyn_eq(other.as_ref()) - } -} |
