Marks unused variables to cut down on warnings

This commit is contained in:
Gregor Reitzenstein 2021-01-26 14:47:58 +00:00
parent bde889582b
commit 4aaa281303
10 changed files with 13 additions and 15 deletions

View File

@ -40,7 +40,7 @@ impl Callback<AppData, SessionData> for CB {
Some(a) => { Some(a) => {
match a.to_str() { match a.to_str() {
Ok(s) => s, Ok(s) => s,
Err(e) => return ReturnCode::GSASL_SASLPREP_ERROR as libc::c_int, Err(_) => return ReturnCode::GSASL_SASLPREP_ERROR as libc::c_int,
} }
}, },
}; };

View File

@ -82,7 +82,7 @@ struct Write(Arc<Machine>);
impl write::Server for Write { impl write::Server for Write {
fn use_(&mut self, fn use_(&mut self,
_params: write::UseParams, _params: write::UseParams,
results: write::UseResults) _results: write::UseResults)
-> Promise<(), Error> -> Promise<(), Error>
{ {
let uid = self.0.session.user.as_ref().map(|u| u.id.clone()); 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 this = self.0.clone();
let f = this.machine.request_state_change(this.session.user.as_ref(), new_state) let f = this.machine.request_state_change(this.session.user.as_ref(), new_state)
.map(|res_token| match res_token { .map(|res_token| match res_token {
Ok(tok) => { // TODO: Do something with the token we get returned
Ok(_tok) => {
return Ok(()); 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) Promise::from_future(f)

View File

@ -42,7 +42,7 @@ impl machines::Server for Machines {
let res = results.get(); let res = results.get();
let mut machines = res.init_machines(v.len() as u32); 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 machine = Arc::new(Machine::new(self.session.clone(), machine, self.db.clone()));
let mut builder = machines.reborrow().get(i as u32); let mut builder = machines.reborrow().get(i as u32);
Machine::fill(machine, &mut builder); Machine::fill(machine, &mut builder);

View File

@ -389,7 +389,7 @@ impl PartialOrd for Permission {
fn partial_cmp(&self, other: &Permission) -> Option<Ordering> { fn partial_cmp(&self, other: &Permission) -> Option<Ordering> {
let mut i = self.iter(); let mut i = self.iter();
let mut j = other.iter(); let mut j = other.iter();
let (mut l, mut r) = (None, None); let (mut l, mut r);
while { while {
l = i.next(); l = i.next();
r = j.next(); r = j.next();

View File

@ -163,7 +163,7 @@ impl RoleDB for Internal {
/// Initialize the access db by loading all the lmdb databases /// Initialize the access db by loading all the lmdb databases
pub fn init(log: Logger, config: &Config, env: Arc<lmdb::Environment>) pub fn init(log: Logger, _config: &Config, env: Arc<lmdb::Environment>)
-> std::result::Result<Internal, crate::error::Error> -> std::result::Result<Internal, crate::error::Error>
{ {
let mut flags = lmdb::DatabaseFlags::empty(); let mut flags = lmdb::DatabaseFlags::empty();

View File

@ -68,7 +68,7 @@ impl MachineState {
} }
} }
pub fn init(log: Logger, config: &Config, env: Arc<lmdb::Environment>) -> Result<Internal> { pub fn init(log: Logger, _config: &Config, env: Arc<lmdb::Environment>) -> Result<Internal> {
let mut flags = lmdb::DatabaseFlags::empty(); let mut flags = lmdb::DatabaseFlags::empty();
flags.set(lmdb::DatabaseFlags::INTEGER_KEY, true); flags.set(lmdb::DatabaseFlags::INTEGER_KEY, true);
let machdb = env.create_db(Some("machines"), flags)?; let machdb = env.create_db(Some("machines"), flags)?;

View File

@ -55,7 +55,7 @@ impl Internal {
pub fn iter<T: Transaction>(&self, txn: &T) -> Result<impl Iterator<Item=MachineState>> { pub fn iter<T: Transaction>(&self, txn: &T) -> Result<impl Iterator<Item=MachineState>> {
let mut cursor = txn.open_ro_cursor(self.db)?; let mut cursor = txn.open_ro_cursor(self.db)?;
Ok(cursor.iter_start().map(|buf| { Ok(cursor.iter_start().map(|buf| {
let (kbuf, vbuf) = buf.unwrap(); let (_kbuf, vbuf) = buf.unwrap();
flexbuffers::from_slice(vbuf).unwrap() flexbuffers::from_slice(vbuf).unwrap()
})) }))
} }

View File

@ -122,7 +122,7 @@ pub fn load_file<P: AsRef<Path>>(path: P) -> Result<HashMap<String, User>> {
))) )))
} }
pub fn init(log: Logger, config: &Config, env: Arc<lmdb::Environment>) -> Result<Internal> { pub fn init(log: Logger, _config: &Config, env: Arc<lmdb::Environment>) -> Result<Internal> {
let mut flags = lmdb::DatabaseFlags::empty(); let mut flags = lmdb::DatabaseFlags::empty();
flags.set(lmdb::DatabaseFlags::INTEGER_KEY, true); flags.set(lmdb::DatabaseFlags::INTEGER_KEY, true);
let db = env.create_db(Some("users"), flags)?; let db = env.create_db(Some("users"), flags)?;

View File

@ -149,10 +149,10 @@ pub fn load(log: &Logger, client: &AsyncClient, config: &Config) -> Result<(Init
fn load_single( fn load_single(
log: &Logger, log: &Logger,
client: &AsyncClient, _client: &AsyncClient,
name: &String, name: &String,
module_name: &String, module_name: &String,
params: &HashMap<String, String> _params: &HashMap<String, String>
) -> Option<BoxSensor> ) -> Option<BoxSensor>
{ {
match module_name.as_ref() { match module_name.as_ref() {

View File

@ -91,9 +91,6 @@ pub fn serve_api_connections(log: Arc<Logger>, config: Config, db: Databases, nw
inner_log.new(o!()) inner_log.new(o!())
}; };
// Clone a log for potential error handling
let elog = log.clone();
// We handle the error using map_err // We handle the error using map_err
let f = handler.handle(socket) let f = handler.handle(socket)
.map_err(move |e| { .map_err(move |e| {