From 4aaa28130321883e2306dfda91d3f3b65f121442 Mon Sep 17 00:00:00 2001 From: Gregor Reitzenstein Date: Tue, 26 Jan 2021 14:47:58 +0000 Subject: [PATCH] Marks unused variables to cut down on warnings --- src/api/auth.rs | 2 +- src/api/machine.rs | 7 ++++--- src/api/machines.rs | 2 +- src/db/access.rs | 2 +- src/db/access/internal.rs | 2 +- src/db/machine.rs | 2 +- src/db/machine/internal.rs | 2 +- src/db/user.rs | 2 +- src/initiator.rs | 4 ++-- src/server.rs | 3 --- 10 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/api/auth.rs b/src/api/auth.rs index 909f2b7..5cb3461 100644 --- a/src/api/auth.rs +++ b/src/api/auth.rs @@ -40,7 +40,7 @@ impl Callback for CB { Some(a) => { match a.to_str() { Ok(s) => s, - Err(e) => return ReturnCode::GSASL_SASLPREP_ERROR as libc::c_int, + Err(_) => return ReturnCode::GSASL_SASLPREP_ERROR as libc::c_int, } }, }; diff --git a/src/api/machine.rs b/src/api/machine.rs index 2199a9d..e9946bb 100644 --- a/src/api/machine.rs +++ b/src/api/machine.rs @@ -82,7 +82,7 @@ struct Write(Arc); impl write::Server for Write { fn use_(&mut self, _params: write::UseParams, - results: write::UseResults) + _results: write::UseResults) -> Promise<(), Error> { let uid = self.0.session.user.as_ref().map(|u| u.id.clone()); @@ -90,10 +90,11 @@ impl write::Server for Write { let this = self.0.clone(); let f = this.machine.request_state_change(this.session.user.as_ref(), new_state) .map(|res_token| match res_token { - Ok(tok) => { + // TODO: Do something with the token we get returned + Ok(_tok) => { return Ok(()); }, - Err(e) => Err(capnp::Error::failed("State change request returned an err".to_string())), + Err(_) => Err(capnp::Error::failed("State change request returned an err".to_string())), }); Promise::from_future(f) diff --git a/src/api/machines.rs b/src/api/machines.rs index ec9536c..86f3389 100644 --- a/src/api/machines.rs +++ b/src/api/machines.rs @@ -42,7 +42,7 @@ impl machines::Server for Machines { let res = results.get(); let mut machines = res.init_machines(v.len() as u32); - for (i, (name, machine)) in v.into_iter().enumerate() { + for (i, (_name, machine)) in v.into_iter().enumerate() { let machine = Arc::new(Machine::new(self.session.clone(), machine, self.db.clone())); let mut builder = machines.reborrow().get(i as u32); Machine::fill(machine, &mut builder); diff --git a/src/db/access.rs b/src/db/access.rs index 3057ff2..c34bd90 100644 --- a/src/db/access.rs +++ b/src/db/access.rs @@ -389,7 +389,7 @@ impl PartialOrd for Permission { fn partial_cmp(&self, other: &Permission) -> Option { let mut i = self.iter(); let mut j = other.iter(); - let (mut l, mut r) = (None, None); + let (mut l, mut r); while { l = i.next(); r = j.next(); diff --git a/src/db/access/internal.rs b/src/db/access/internal.rs index aa22674..1f8213b 100644 --- a/src/db/access/internal.rs +++ b/src/db/access/internal.rs @@ -163,7 +163,7 @@ impl RoleDB for Internal { /// Initialize the access db by loading all the lmdb databases -pub fn init(log: Logger, config: &Config, env: Arc) +pub fn init(log: Logger, _config: &Config, env: Arc) -> std::result::Result { let mut flags = lmdb::DatabaseFlags::empty(); diff --git a/src/db/machine.rs b/src/db/machine.rs index 0d1c404..b7d8dfa 100644 --- a/src/db/machine.rs +++ b/src/db/machine.rs @@ -68,7 +68,7 @@ impl MachineState { } } -pub fn init(log: Logger, config: &Config, env: Arc) -> Result { +pub fn init(log: Logger, _config: &Config, env: Arc) -> Result { let mut flags = lmdb::DatabaseFlags::empty(); flags.set(lmdb::DatabaseFlags::INTEGER_KEY, true); let machdb = env.create_db(Some("machines"), flags)?; diff --git a/src/db/machine/internal.rs b/src/db/machine/internal.rs index eda4f69..9ae80be 100644 --- a/src/db/machine/internal.rs +++ b/src/db/machine/internal.rs @@ -55,7 +55,7 @@ impl Internal { pub fn iter(&self, txn: &T) -> Result> { let mut cursor = txn.open_ro_cursor(self.db)?; Ok(cursor.iter_start().map(|buf| { - let (kbuf, vbuf) = buf.unwrap(); + let (_kbuf, vbuf) = buf.unwrap(); flexbuffers::from_slice(vbuf).unwrap() })) } diff --git a/src/db/user.rs b/src/db/user.rs index e26bdaa..2a174e0 100644 --- a/src/db/user.rs +++ b/src/db/user.rs @@ -122,7 +122,7 @@ pub fn load_file>(path: P) -> Result> { ))) } -pub fn init(log: Logger, config: &Config, env: Arc) -> Result { +pub fn init(log: Logger, _config: &Config, env: Arc) -> Result { let mut flags = lmdb::DatabaseFlags::empty(); flags.set(lmdb::DatabaseFlags::INTEGER_KEY, true); let db = env.create_db(Some("users"), flags)?; diff --git a/src/initiator.rs b/src/initiator.rs index a207966..03474c5 100644 --- a/src/initiator.rs +++ b/src/initiator.rs @@ -149,10 +149,10 @@ pub fn load(log: &Logger, client: &AsyncClient, config: &Config) -> Result<(Init fn load_single( log: &Logger, - client: &AsyncClient, + _client: &AsyncClient, name: &String, module_name: &String, - params: &HashMap + _params: &HashMap ) -> Option { match module_name.as_ref() { diff --git a/src/server.rs b/src/server.rs index 32a789e..eaf0eab 100644 --- a/src/server.rs +++ b/src/server.rs @@ -91,9 +91,6 @@ pub fn serve_api_connections(log: Arc, config: Config, db: Databases, nw inner_log.new(o!()) }; - // Clone a log for potential error handling - let elog = log.clone(); - // We handle the error using map_err let f = handler.handle(socket) .map_err(move |e| {