Browse Source

Removing useless mutables

pull/104/head
Rodolphe Bréard 1 year ago
parent
commit
e5faca7c5a
  1. 10
      acmed/src/account.rs
  2. 2
      acmed/src/config.rs

10
acmed/src/account.rs

@ -242,27 +242,27 @@ impl Account {
} }
pub fn set_account_url(&mut self, endpoint_name: &str, account_url: &str) -> Result<(), Error> { pub fn set_account_url(&mut self, endpoint_name: &str, account_url: &str) -> Result<(), Error> {
let mut ep = self.get_endpoint_mut(endpoint_name)?;
let ep = self.get_endpoint_mut(endpoint_name)?;
ep.account_url = account_url.to_string(); ep.account_url = account_url.to_string();
Ok(()) Ok(())
} }
pub fn set_orders_url(&mut self, endpoint_name: &str, orders_url: &str) -> Result<(), Error> { pub fn set_orders_url(&mut self, endpoint_name: &str, orders_url: &str) -> Result<(), Error> {
let mut ep = self.get_endpoint_mut(endpoint_name)?;
let ep = self.get_endpoint_mut(endpoint_name)?;
ep.orders_url = orders_url.to_string(); ep.orders_url = orders_url.to_string();
Ok(()) Ok(())
} }
pub fn update_key_hash(&mut self, endpoint_name: &str) -> Result<(), Error> { pub fn update_key_hash(&mut self, endpoint_name: &str) -> Result<(), Error> {
let key = self.current_key.clone(); let key = self.current_key.clone();
let mut ep = self.get_endpoint_mut(endpoint_name)?;
let ep = self.get_endpoint_mut(endpoint_name)?;
ep.key_hash = hash_key(&key)?; ep.key_hash = hash_key(&key)?;
Ok(()) Ok(())
} }
pub fn update_contacts_hash(&mut self, endpoint_name: &str) -> Result<(), Error> { pub fn update_contacts_hash(&mut self, endpoint_name: &str) -> Result<(), Error> {
let ct = self.contacts.clone(); let ct = self.contacts.clone();
let mut ep = self.get_endpoint_mut(endpoint_name)?;
let ep = self.get_endpoint_mut(endpoint_name)?;
ep.contacts_hash = hash_contacts(&ct); ep.contacts_hash = hash_contacts(&ct);
Ok(()) Ok(())
} }
@ -270,7 +270,7 @@ impl Account {
pub fn update_external_account_hash(&mut self, endpoint_name: &str) -> Result<(), Error> { pub fn update_external_account_hash(&mut self, endpoint_name: &str) -> Result<(), Error> {
if let Some(ec) = &self.external_account { if let Some(ec) = &self.external_account {
let ec = ec.clone(); let ec = ec.clone();
let mut ep = self.get_endpoint_mut(endpoint_name)?;
let ep = self.get_endpoint_mut(endpoint_name)?;
ep.external_account_hash = hash_external_account(&ec); ep.external_account_hash = hash_external_account(&ec);
} }
Ok(()) Ok(())

2
acmed/src/config.rs

@ -760,7 +760,7 @@ fn read_cnf(path: &Path, loaded_files: &mut BTreeSet<PathBuf>) -> Result<Config,
fn dispatch_global_env_vars(config: &mut Config) { fn dispatch_global_env_vars(config: &mut Config) {
if let Some(glob) = &config.global { if let Some(glob) = &config.global {
if !glob.env.is_empty() { if !glob.env.is_empty() {
for mut cert in config.certificate.iter_mut() {
for cert in config.certificate.iter_mut() {
let mut new_vars = glob.env.clone(); let mut new_vars = glob.env.clone();
for (k, v) in cert.env.iter() { for (k, v) in cert.env.iter() {
new_vars.insert(k.to_string(), v.to_string()); new_vars.insert(k.to_string(), v.to_string());

Loading…
Cancel
Save