From bde889582b794dd57c40cb1ffe33f71544e719bc Mon Sep 17 00:00:00 2001 From: Gregor Reitzenstein Date: Tue, 26 Jan 2021 14:42:04 +0000 Subject: [PATCH] Fixes unecessary `mut` all over the place --- src/api/auth.rs | 2 +- src/api/machines.rs | 2 +- src/connection.rs | 2 +- src/db.rs | 2 +- src/db/machine/internal.rs | 2 +- src/machine.rs | 2 +- src/main.rs | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/api/auth.rs b/src/api/auth.rs index bb5ab88..909f2b7 100644 --- a/src/api/auth.rs +++ b/src/api/auth.rs @@ -84,7 +84,7 @@ impl Auth { pub fn new(passdb: Arc, session: Arc) -> Self { let mut ctx = SASL::new().unwrap(); - let mut appdata = Box::new(AppData { passdb }); + let appdata = Box::new(AppData { passdb }); ctx.store(appdata); diff --git a/src/api/machines.rs b/src/api/machines.rs index ad5b014..ec9536c 100644 --- a/src/api/machines.rs +++ b/src/api/machines.rs @@ -39,7 +39,7 @@ impl machines::Server for Machines { .map(|(n, m)| (n.clone(), m.clone())) .collect(); - let mut res = results.get(); + let res = results.get(); let mut machines = res.init_machines(v.len() as u32); for (i, (name, machine)) in v.into_iter().enumerate() { diff --git a/src/connection.rs b/src/connection.rs index e351d8e..56cafd8 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -56,7 +56,7 @@ impl ConnectionHandler { Self { log, db, network } } - pub fn handle(&mut self, mut stream: TcpStream) -> impl Future> { + pub fn handle(&mut self, stream: TcpStream) -> impl Future> { info!(self.log, "New connection from on {:?}", stream); let session = Arc::new(Session::new(self.log.new(o!()), self.db.access.clone())); let boots = Bootstrap::new(session, self.db.clone(), self.network.clone()); diff --git a/src/db.rs b/src/db.rs index 09bf096..0e86860 100644 --- a/src/db.rs +++ b/src/db.rs @@ -50,7 +50,7 @@ impl Databases { let mdb = machine::init(log.new(o!("system" => "machines")), &config, env.clone())?; let permdb = access::init(log.new(o!("system" => "permissions")), &config, env.clone())?; - let mut ac = access::AccessControl::new(permdb); + let ac = access::AccessControl::new(permdb); let passdb = pass::PassDB::init(log.new(o!("system" => "passwords")), env.clone()).unwrap(); diff --git a/src/db/machine/internal.rs b/src/db/machine/internal.rs index 59de116..eda4f69 100644 --- a/src/db/machine/internal.rs +++ b/src/db/machine/internal.rs @@ -24,7 +24,7 @@ impl Internal { { match txn.get(self.db, &id.as_bytes()) { Ok(bytes) => { - let mut machine: MachineState = flexbuffers::from_slice(bytes)?; + let machine: MachineState = flexbuffers::from_slice(bytes)?; Ok(Some(machine)) }, Err(lmdb::Error::NotFound) => { Ok(None) }, diff --git a/src/machine.rs b/src/machine.rs index 527db26..3e37787 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -203,7 +203,7 @@ impl Future for Inner { type Output = MachineState; fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { - let mut this = &mut *self; + let this = &mut *self; // TODO Return this on exit if false { return Poll::Ready(self.state.get_cloned()); diff --git a/src/main.rs b/src/main.rs index 8a4669c..40faf95 100644 --- a/src/main.rs +++ b/src/main.rs @@ -153,8 +153,8 @@ fn maybe(matches: clap::ArgMatches, log: Arc) -> Result<(), Error> { smol::block_on(tok)?; let machines = machine::load(&config, db.access.clone())?; - let (mut actor_map, actors) = actor::load(&log, &mqtt, &config)?; - let (mut init_map, initiators) = initiator::load(&log, &mqtt, &config)?; + let (actor_map, actors) = actor::load(&log, &mqtt, &config)?; + let (init_map, initiators) = initiator::load(&log, &mqtt, &config)?; // TODO: restore connections between initiators, machines, actors let mut network = network::Network::new(machines, actor_map, init_map);