From 8bcd03c7dae87f81c70fb1f8700060ea9a477509 Mon Sep 17 00:00:00 2001 From: Adrian Heine Date: Wed, 2 Oct 2019 16:22:11 +0200 Subject: [PATCH] Use clone in newAcmeUser --- src/symbols/acme/user.rs | 7 +++---- src/symbols/factory.rs | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/symbols/acme/user.rs b/src/symbols/acme/user.rs index 0ba21d5..e121ae6 100644 --- a/src/symbols/acme/user.rs +++ b/src/symbols/acme/user.rs @@ -8,7 +8,7 @@ use symbols::list::List; use symbols::owner::Owner; use symbols::Symbol; -pub fn new<'a, R: CommandRunner, C: 'a + AsRef, U: 'a + AsRef, H: AsRef>( +pub fn new<'a, R: CommandRunner, C: 'a + AsRef, U: 'a + AsRef + Clone, H: AsRef>( command_runner: &'a R, cert: C, user_name: U, @@ -18,16 +18,15 @@ pub fn new<'a, R: CommandRunner, C: 'a + AsRef, U: 'a + AsRef, H: AsRe let account_key_file = path("account.key"); List::from(( AcmeAccountKey::new(account_key_file.clone(), command_runner), - // FIXME into or cow or clone Owner::new( account_key_file, - user_name.as_ref().to_owned(), + user_name.clone(), command_runner, ), Dir::new(path("challenges")), Owner::new( path("challenges"), - user_name.as_ref().to_owned(), + user_name.clone(), command_runner, ), Dir::new("/etc/ssl/local_certs"), diff --git a/src/symbols/factory.rs b/src/symbols/factory.rs index c8e8654..f83a2cd 100644 --- a/src/symbols/factory.rs +++ b/src/symbols/factory.rs @@ -341,13 +341,13 @@ env[PATH] = /usr/local/bin:/usr/bin:/bin Cron::new(user, content, self.command_runner) } - pub fn get_acme_user<'a, S: 'a + AsRef, D: 'a + AsRef>( + pub fn get_acme_user<'a, S: 'a + AsRef + Clone, D: 'a + AsRef>( &'a self, cert: D, user_name: S, ) -> impl Symbol + 'a { let home = self.policy.home_for_user(user_name.as_ref()); - newAcmeUser(self.command_runner, cert, user_name, home) + newAcmeUser(self.command_runner, cert, user_name.clone(), home) } pub fn get_systemd_user_service<'a>(