From 8248d6e8f6dd0798f22f6f3735ca99f9d1bbf513 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Fri, 27 Jan 2023 08:59:04 -0800 Subject: [PATCH] graphlog: remove use of `PhantomData` --- src/graphlog.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/graphlog.rs b/src/graphlog.rs index 54c15a452..8c9f09bb1 100644 --- a/src/graphlog.rs +++ b/src/graphlog.rs @@ -15,7 +15,6 @@ use std::hash::Hash; use std::io; use std::io::Write; -use std::marker::PhantomData; use itertools::Itertools; use jujutsu_lib::settings::UserSettings; @@ -58,10 +57,9 @@ pub trait GraphLog { ) -> io::Result<()>; } -pub struct SaplingGraphLog<'writer, K, R: Renderer> { +pub struct SaplingGraphLog<'writer, R> { renderer: R, writer: &'writer mut dyn Write, - phantom: PhantomData, } impl From<&Edge> for Ancestor { @@ -77,7 +75,7 @@ impl From<&Edge> for Ancestor { } } -impl<'writer, K, R> GraphLog for SaplingGraphLog<'writer, K, R> +impl<'writer, K, R> GraphLog for SaplingGraphLog<'writer, R> where K: Clone + Eq + Hash, R: Renderer, @@ -100,19 +98,18 @@ where } } -impl<'writer, K, R> SaplingGraphLog<'writer, K, R> -where - K: Clone + Eq + Hash + 'writer, - R: Renderer + 'writer, -{ - pub fn create( +impl<'writer, R> SaplingGraphLog<'writer, R> { + pub fn create( renderer: R, formatter: &'writer mut dyn Write, - ) -> Box + 'writer> { + ) -> Box + 'writer> + where + K: Clone + Eq + Hash + 'writer, + R: Renderer + 'writer, + { Box::new(SaplingGraphLog { renderer, writer: formatter, - phantom: PhantomData, }) } }