From 65de5fb4658e92f0730901b8b083af375050bd64 Mon Sep 17 00:00:00 2001 From: Maxim <59533214+biryukovmaxim@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:04:31 +0300 Subject: refactor: use `Arc` instead of making copies of `Flags` struct (#13610) --- cli/flags.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'cli/flags.rs') diff --git a/cli/flags.rs b/cli/flags.rs index d4ba685fb..7255502fe 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -384,19 +384,17 @@ impl Flags { vec![] } } -} -impl From for PermissionsOptions { - fn from(flags: Flags) -> Self { - Self { - allow_env: flags.allow_env, - allow_hrtime: flags.allow_hrtime, - allow_net: flags.allow_net, - allow_ffi: flags.allow_ffi, - allow_read: flags.allow_read, - allow_run: flags.allow_run, - allow_write: flags.allow_write, - prompt: flags.prompt, + pub fn permissions_options(&self) -> PermissionsOptions { + PermissionsOptions { + allow_env: self.allow_env.clone(), + allow_hrtime: self.allow_hrtime, + allow_net: self.allow_net.clone(), + allow_ffi: self.allow_ffi.clone(), + allow_read: self.allow_read.clone(), + allow_run: self.allow_run.clone(), + allow_write: self.allow_write.clone(), + prompt: self.prompt, } } } -- cgit v1.2.3