avoid compiler warnings

This commit is contained in:
Dietmar Maurer
2019-01-30 18:25:37 +01:00
parent 34f956bc25
commit 9f49fe1d5d
18 changed files with 60 additions and 119 deletions

View File

@ -1,8 +1,8 @@
use failure::*;
//use failure::*;
use crate::api::schema::*;
use crate::api::router::*;
use serde_json::{json, Value};
use serde_json::{json};
use std::sync::Arc;
pub mod config;
@ -29,54 +29,11 @@ lazy_static! {
}
fn test_sync_api_handler(
param: Value,
_info: &ApiMethod,
_rpcenv: &mut RpcEnvironment,
) -> Result<Value, Error> {
println!("This is a test {}", param);
// let force: Option<bool> = Some(false);
//if let Some(force) = param.force {
//}
let _force = param["force"].as_bool()
.ok_or_else(|| format_err!("missing parameter 'force'"))?;
if let Some(_force) = param["force"].as_bool() {
}
Ok(json!(null))
}
pub fn router() -> Router {
let route4 = Router::new()
.get(ApiMethod::new(
|param, _info, _rpcenv| {
println!("This is a clousure handler: {}", param);
Ok(json!(null))
},
ObjectSchema::new("Another Endpoint."))
.returns(Schema::Null));
let nodeinfo = Router::new()
.get(ApiMethod::new(
test_sync_api_handler,
ObjectSchema::new("This is a simple test.")
.optional("force", BooleanSchema::new("Test for boolean options")))
)
.subdir("subdir3", route4);
let nodes = Router::new()
.subdir("localhost", node::router());
let route = Router::new()
.get(ApiMethod::new(
|_,_,_| Ok(json!([