From 7fd7bccf18656d7668bd1439f1df99581b302c6d Mon Sep 17 00:00:00 2001 From: Marek Kaput Date: Mon, 30 Oct 2023 19:19:39 +0100 Subject: [PATCH] Impl `Clone` for `Ui` (#807) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Stack**: - #846 - #845 - #844 - #843 - #819 - #818 - #809 - #808 - #807 ⬅ ⚠️ *Part of a stack created by [spr](https://github.com/ejoffe/spr). Do not merge manually using the UI - doing so may have unexpected results.* --- scarb/src/core/config.rs | 4 ++-- scarb/src/resolver/mod.rs | 4 ++-- utils/scarb-ui/src/lib.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scarb/src/core/config.rs b/scarb/src/core/config.rs index acf671702..6d20d6890 100644 --- a/scarb/src/core/config.rs +++ b/scarb/src/core/config.rs @@ -170,8 +170,8 @@ impl Config { .map(AsRef::as_ref) } - pub fn ui(&self) -> &Ui { - &self.ui + pub fn ui(&self) -> Ui { + self.ui.clone() } pub fn elapsed_time(&self) -> Duration { diff --git a/scarb/src/resolver/mod.rs b/scarb/src/resolver/mod.rs index 6368bb87b..7c1b6a2ef 100644 --- a/scarb/src/resolver/mod.rs +++ b/scarb/src/resolver/mod.rs @@ -30,7 +30,7 @@ pub async fn resolve( summaries: &[Summary], registry: &dyn Registry, lockfile: Lockfile, - ui: &Ui, + ui: Ui, ) -> Result { // TODO(#2): This is very bad, use PubGrub here. let mut graph = DiGraphMap::::new(); @@ -285,7 +285,7 @@ mod tests { let lockfile = Lockfile::new(locks.iter().cloned()); let ui = Ui::new(Verbose, OutputFormat::Text); - runtime.block_on(super::resolve(&summaries, ®istry, lockfile, &ui)) + runtime.block_on(super::resolve(&summaries, ®istry, lockfile, ui)) } fn package_id>(name: S) -> PackageId { diff --git a/utils/scarb-ui/src/lib.rs b/utils/scarb-ui/src/lib.rs index 37e60b760..a7f8e0279 100644 --- a/utils/scarb-ui/src/lib.rs +++ b/utils/scarb-ui/src/lib.rs @@ -53,7 +53,7 @@ pub enum OutputFormat { /// colour, etc. /// /// All human-oriented messaging (basically all writes to `stdout`) must go through this object. -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct Ui { verbosity: Verbosity, output_format: OutputFormat,