Fixes unecessary mut all over the place

This commit is contained in:
Gregor Reitzenstein 2021-01-26 14:42:04 +00:00
parent c0618e949d
commit bde889582b
7 changed files with 8 additions and 8 deletions

View File

@ -84,7 +84,7 @@ impl Auth {
pub fn new(passdb: Arc<PassDB>, session: Arc<Session>) -> Self {
let mut ctx = SASL::new().unwrap();
let mut appdata = Box::new(AppData { passdb });
let appdata = Box::new(AppData { passdb });
ctx.store(appdata);

View File

@ -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() {

View File

@ -56,7 +56,7 @@ impl ConnectionHandler {
Self { log, db, network }
}
pub fn handle(&mut self, mut stream: TcpStream) -> impl Future<Output=Result<()>> {
pub fn handle(&mut self, stream: TcpStream) -> impl Future<Output=Result<()>> {
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());

View File

@ -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();

View File

@ -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) },

View File

@ -203,7 +203,7 @@ impl Future for Inner {
type Output = MachineState;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let mut this = &mut *self;
let this = &mut *self;
// TODO Return this on exit
if false {
return Poll::Ready(self.state.get_cloned());

View File

@ -153,8 +153,8 @@ fn maybe(matches: clap::ArgMatches, log: Arc<Logger>) -> 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);