src/api2/admin/datastore/h2upload.rs: code cleanups

This commit is contained in:
Dietmar Maurer 2019-05-08 11:36:43 +02:00
parent 58c8d7d91f
commit d906b1124f
1 changed files with 6 additions and 3 deletions

View File

@ -3,7 +3,6 @@ use lazy_static::lazy_static;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::Arc; use std::sync::Arc;
use std::any::Any;
use futures::*; use futures::*;
use hyper::header::{HeaderValue, UPGRADE}; use hyper::header::{HeaderValue, UPGRADE};
@ -69,7 +68,7 @@ impl RpcEnvironment for BackupEnvironment {
self.env_type self.env_type
} }
fn set_user(&mut self, user: Option<String>) { fn set_user(&mut self, _user: Option<String>) {
panic!("unable to change user"); panic!("unable to change user");
} }
@ -268,6 +267,10 @@ fn backup_api() -> Router {
router router
} }
fn get_backup_environment(rpcenv: &mut RpcEnvironment) -> &BackupEnvironment {
rpcenv.as_any().downcast_ref::<BackupEnvironment>().unwrap()
}
fn test1_get ( fn test1_get (
_param: Value, _param: Value,
_info: &ApiMethod, _info: &ApiMethod,
@ -276,7 +279,7 @@ fn test1_get (
println!("TYPEID {:?}", (*rpcenv).type_id()); println!("TYPEID {:?}", (*rpcenv).type_id());
let env = rpcenv.as_any().downcast_ref::<BackupEnvironment>().unwrap(); let env = get_backup_environment(rpcenv);
env.log("Inside test1_get()"); env.log("Inside test1_get()");