From 13230db68c3cb2842f23f95fc1b47fd989e6277d Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 7 Oct 2020 19:28:34 +0200 Subject: =?UTF-8?q?Fix=20some=20clippy=20warnings=20=E2=9C=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/nodes/document.rs | 5 ----- src/layout/nodes/mod.rs | 31 ++++++++++++------------------- 2 files changed, 12 insertions(+), 24 deletions(-) (limited to 'src/layout') 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 { 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); 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 for LayoutNode { fn from(dynamic: Dynamic) -> Self { Self::Dyn(dynamic) @@ -153,15 +158,3 @@ where Box::new(self.clone()) } } - -impl Clone for Box { - fn clone(&self) -> Self { - self.dyn_clone() - } -} - -impl PartialEq for Box { - fn eq(&self, other: &Self) -> bool { - self.dyn_eq(other.as_ref()) - } -} -- cgit v1.2.3