From c046e1c8450fffd4351c1fb6540953060bcb282c Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Tue, 18 Oct 2022 17:44:10 -0700 Subject: [PATCH] Remove superfluous lifetime from Ui --- src/cli_util.rs | 2 +- src/ui.rs | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/cli_util.rs b/src/cli_util.rs index f79040560..5b3e4d129 100644 --- a/src/cli_util.rs +++ b/src/cli_util.rs @@ -1175,7 +1175,7 @@ pub struct GlobalArgs { pub color: Option, } -pub fn create_ui() -> (Ui<'static>, Result<(), CommandError>) { +pub fn create_ui() -> (Ui, Result<(), CommandError>) { // TODO: We need to do some argument parsing here, at least for things like // --config, and for reading user configs from the repo pointed to by -R. match read_config() { diff --git a/src/ui.rs b/src/ui.rs index 190993385..2cfd9af0e 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -24,10 +24,10 @@ use jujutsu_lib::settings::UserSettings; use crate::formatter::{Formatter, FormatterFactory}; -pub struct Ui<'a> { +pub struct Ui { cwd: PathBuf, formatter_factory: FormatterFactory, - output_pair: UiOutputPair<'a>, + output_pair: UiOutputPair, settings: UserSettings, } @@ -74,14 +74,14 @@ fn use_color(choice: ColorChoice, maybe_tty: bool) -> bool { } } -impl<'stdout> Ui<'stdout> { +impl Ui { pub fn new( cwd: PathBuf, - stdout: Box, - stderr: Box, + stdout: Box, + stderr: Box, color: bool, settings: UserSettings, - ) -> Ui<'stdout> { + ) -> Ui { let formatter_factory = FormatterFactory::prepare(&settings, color); Ui { cwd, @@ -94,7 +94,7 @@ impl<'stdout> Ui<'stdout> { } } - pub fn for_terminal(settings: UserSettings) -> Ui<'static> { + pub fn for_terminal(settings: UserSettings) -> Ui { let cwd = std::env::current_dir().unwrap(); let color = use_color(color_setting(&settings), true); let formatter_factory = FormatterFactory::prepare(&settings, color); @@ -227,10 +227,10 @@ impl<'stdout> Ui<'stdout> { } } -enum UiOutputPair<'output> { +enum UiOutputPair { Dyn { - stdout: Mutex>, - stderr: Mutex>, + stdout: Mutex>, + stderr: Mutex>, }, Terminal { stdout: Stdout,