router change made one level of rpcenv mut superfluous

Created via `cargo fix`.  see commit
47acc8dc8f68ed2c5db69b1678b479e05b0a3194 from proxmox-rs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-05-03 09:43:04 +02:00
parent aefbaa4dc6
commit 41c1a17999
24 changed files with 38 additions and 41 deletions

View File

@ -109,7 +109,7 @@ fn extract_acl_node_data(
pub fn read_acl(
path: Option<String>,
exact: bool,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<AclListItem>, Error> {
let auth_id = rpcenv.get_auth_id().unwrap().parse()?;

View File

@ -22,7 +22,7 @@ use pbs_api_types::BasicRealmInfo;
}
)]
/// Authentication domain/realm index.
fn list_domains(mut rpcenv: &mut dyn RpcEnvironment) -> Result<Vec<BasicRealmInfo>, Error> {
fn list_domains(rpcenv: &mut dyn RpcEnvironment) -> Result<Vec<BasicRealmInfo>, Error> {
let mut list = Vec::new();
list.push(serde_json::from_value(json!({

View File

@ -56,7 +56,7 @@ fn new_user_with_tokens(user: User) -> UserWithTokens {
pub fn list_users(
include_tokens: bool,
_info: &ApiMethod,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<UserWithTokens>, Error> {
let (config, digest) = pbs_config::user::config()?;
@ -179,7 +179,7 @@ pub fn create_user(
},
)]
/// Read user configuration data.
pub fn read_user(userid: Userid, mut rpcenv: &mut dyn RpcEnvironment) -> Result<User, Error> {
pub fn read_user(userid: Userid, rpcenv: &mut dyn RpcEnvironment) -> Result<User, Error> {
let (config, digest) = pbs_config::user::config()?;
let user = config.lookup("user", userid.as_str())?;
rpcenv["digest"] = hex::encode(&digest).into();
@ -417,7 +417,7 @@ pub fn read_token(
userid: Userid,
token_name: Tokenname,
_info: &ApiMethod,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<ApiToken, Error> {
let (config, digest) = pbs_config::user::config()?;
@ -705,7 +705,7 @@ pub struct TokenApiEntry {
pub fn list_tokens(
userid: Userid,
_info: &ApiMethod,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<TokenApiEntry>, Error> {
let (config, digest) = pbs_config::user::config()?;

View File

@ -45,7 +45,7 @@ use crate::{
pub fn list_sync_jobs(
store: Option<String>,
_param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<SyncJobStatus>, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;

View File

@ -44,7 +44,7 @@ pub struct TrafficControlCurrentRate {
)]
/// Show current traffic for all traffic control rules.
pub fn show_current_traffic(
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<TrafficControlCurrentRate>, Error> {
let (config, digest) = pbs_config::traffic_control::config()?;

View File

@ -45,7 +45,7 @@ use crate::server::{
pub fn list_verification_jobs(
store: Option<String>,
_param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<VerificationJobStatus>, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;

View File

@ -30,7 +30,7 @@ use pbs_config::domains;
/// List configured OpenId realms
pub fn list_openid_realms(
_param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<OpenIdRealmConfig>, Error> {
let (config, digest) = domains::config()?;
@ -132,7 +132,7 @@ pub fn delete_openid_realm(
/// Read the OpenID realm configuration
pub fn read_openid_realm(
realm: String,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<OpenIdRealmConfig, Error> {
let (domains, digest) = domains::config()?;

View File

@ -38,7 +38,7 @@ const WEBAUTHN_ROUTER: Router = Router::new()
)]
/// Get the TFA configuration.
pub fn get_webauthn_config(
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Option<WebauthnConfig>, Error> {
let (config, digest) = match tfa::webauthn_config()? {
Some(c) => c,

View File

@ -519,7 +519,7 @@ fn modify_cfg_for_api(id: &str, ty: &str, data: &Value) -> PluginConfig {
},
)]
/// List ACME challenge plugins.
pub fn list_plugins(mut rpcenv: &mut dyn RpcEnvironment) -> Result<Vec<PluginConfig>, Error> {
pub fn list_plugins(rpcenv: &mut dyn RpcEnvironment) -> Result<Vec<PluginConfig>, Error> {
let (plugins, digest) = plugin::config()?;
rpcenv["digest"] = hex::encode(&digest).into();
Ok(plugins
@ -541,7 +541,7 @@ pub fn list_plugins(mut rpcenv: &mut dyn RpcEnvironment) -> Result<Vec<PluginCon
returns: { type: PluginConfig },
)]
/// List ACME challenge plugins.
pub fn get_plugin(id: String, mut rpcenv: &mut dyn RpcEnvironment) -> Result<PluginConfig, Error> {
pub fn get_plugin(id: String, rpcenv: &mut dyn RpcEnvironment) -> Result<PluginConfig, Error> {
let (plugins, digest) = plugin::config()?;
rpcenv["digest"] = hex::encode(&digest).into();

View File

@ -80,7 +80,7 @@ pub fn create_changer(config: ScsiTapeChanger) -> Result<(), Error> {
pub fn get_config(
name: String,
_param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<ScsiTapeChanger, Error> {
let (config, digest) = pbs_config::drive::config()?;
@ -110,7 +110,7 @@ pub fn get_config(
/// List changers
pub fn list_changers(
_param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<ScsiTapeChanger>, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;

View File

@ -44,7 +44,7 @@ use crate::server::jobstate;
/// List all datastores
pub fn list_datastores(
_param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<DataStoreConfig>, Error> {
let (config, digest) = pbs_config::datastore::config()?;
@ -144,7 +144,7 @@ pub fn create_datastore(
/// Read a datastore configuration.
pub fn read_datastore(
name: String,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<DataStoreConfig, Error> {
let (config, digest) = pbs_config::datastore::config()?;

View File

@ -80,7 +80,7 @@ pub fn create_drive(config: LtoTapeDrive) -> Result<(), Error> {
pub fn get_config(
name: String,
_param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<LtoTapeDrive, Error> {
let (config, digest) = pbs_config::drive::config()?;
@ -110,7 +110,7 @@ pub fn get_config(
/// List drives
pub fn list_drives(
_param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<LtoTapeDrive>, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;

View File

@ -56,7 +56,7 @@ pub fn create_pool(config: MediaPoolConfig) -> Result<(), Error> {
},
)]
/// List media pools
pub fn list_pools(mut rpcenv: &mut dyn RpcEnvironment) -> Result<Vec<MediaPoolConfig>, Error> {
pub fn list_pools(rpcenv: &mut dyn RpcEnvironment) -> Result<Vec<MediaPoolConfig>, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;

View File

@ -37,7 +37,7 @@ use pbs_config::CachedUserInfo;
pub fn list_remotes(
_param: Value,
_info: &ApiMethod,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<RemoteWithoutPassword>, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;
@ -120,7 +120,7 @@ pub fn create_remote(name: String, config: RemoteConfig, password: String) -> Re
pub fn read_remote(
name: String,
_info: &ApiMethod,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<RemoteWithoutPassword, Error> {
let (config, digest) = pbs_config::remote::config()?;
let data: RemoteWithoutPassword = config.lookup("remote", &name)?;

View File

@ -81,7 +81,7 @@ pub fn check_sync_job_modify_access(
/// List all sync jobs
pub fn list_sync_jobs(
_param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<SyncJobConfig>, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;
@ -158,10 +158,7 @@ pub fn create_sync_job(
},
)]
/// Read a sync job configuration.
pub fn read_sync_job(
id: String,
mut rpcenv: &mut dyn RpcEnvironment,
) -> Result<SyncJobConfig, Error> {
pub fn read_sync_job(id: String, rpcenv: &mut dyn RpcEnvironment) -> Result<SyncJobConfig, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;

View File

@ -30,7 +30,7 @@ use pbs_config::CachedUserInfo;
/// List all tape backup jobs
pub fn list_tape_backup_jobs(
_param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<TapeBackupJobConfig>, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;
@ -104,7 +104,7 @@ pub fn create_tape_backup_job(
/// Read a tape backup job configuration.
pub fn read_tape_backup_job(
id: String,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<TapeBackupJobConfig, Error> {
let (config, digest) = pbs_config::tape_job::config()?;

View File

@ -35,7 +35,7 @@ use pbs_config::tape_encryption_keys::{
pub fn list_keys(
_param: Value,
_info: &ApiMethod,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<KeyInfo>, Error> {
let (key_map, digest) = load_key_configs()?;

View File

@ -28,7 +28,7 @@ use pbs_api_types::{
pub fn list_traffic_controls(
_param: Value,
_info: &ApiMethod,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<TrafficControlRule>, Error> {
let (config, digest) = pbs_config::traffic_control::config()?;
@ -91,7 +91,7 @@ pub fn create_traffic_control(config: TrafficControlRule) -> Result<(), Error> {
pub fn read_traffic_control(
name: String,
_info: &ApiMethod,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<TrafficControlRule, Error> {
let (config, digest) = pbs_config::traffic_control::config()?;
let data: TrafficControlRule = config.lookup("rule", &name)?;

View File

@ -31,7 +31,7 @@ use pbs_config::CachedUserInfo;
/// List all verification jobs
pub fn list_verification_jobs(
_param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<VerificationJobConfig>, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;
@ -120,7 +120,7 @@ pub fn create_verification_job(
/// Read a verification job configuration.
pub fn read_verification_job(
id: String,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<VerificationJobConfig, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;

View File

@ -28,7 +28,7 @@ pub const ROUTER: Router = Router::new()
},
)]
/// Get the node configuration
pub fn get_node_config(mut rpcenv: &mut dyn RpcEnvironment) -> Result<NodeConfig, Error> {
pub fn get_node_config(rpcenv: &mut dyn RpcEnvironment) -> Result<NodeConfig, Error> {
let (config, digest) = crate::config::node::config()?;
rpcenv["digest"] = hex::encode(&digest).into();
Ok(config)

View File

@ -109,7 +109,7 @@ fn set_bond_slaves(iface: &mut Interface, slaves: Vec<String>) -> Result<(), Err
pub fn list_network_devices(
_param: Value,
_info: &ApiMethod,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Value, Error> {
let (config, digest) = network::config()?;
let digest = hex::encode(&digest);

View File

@ -140,7 +140,7 @@ fn dump_journal(
fn get_syslog(
param: Value,
_info: &ApiMethod,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Value, Error> {
let service = param["service"]
.as_str()

View File

@ -293,7 +293,7 @@ fn extract_upid(param: &Value) -> Result<UPID, Error> {
},
)]
/// Read task log.
async fn read_task_log(param: Value, mut rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
async fn read_task_log(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
let upid = extract_upid(&param)?;
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
@ -463,7 +463,7 @@ pub fn list_tasks(
typefilter: Option<String>,
statusfilter: Option<Vec<TaskStateType>>,
param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<TaskListItem>, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;

View File

@ -79,7 +79,7 @@ fn check_backup_permission(
/// List all tape backup jobs
pub fn list_tape_backup_jobs(
_param: Value,
mut rpcenv: &mut dyn RpcEnvironment,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<TapeBackupJobStatus>, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let user_info = CachedUserInfo::new()?;