From: Ian Jackson Date: Sun, 1 Nov 2020 21:36:36 +0000 (+0000) Subject: wip errors from introducing accounts X-Git-Tag: otter-0.2.0~572 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9ac6ed9718f705ef0bf35b08c2722a619b155fda;p=otter.git wip errors from introducing accounts Signed-off-by: Ian Jackson --- diff --git a/src/accounts.rs b/src/accounts.rs index 81d002cd..24cbc09d 100644 --- a/src/accounts.rs +++ b/src/accounts.rs @@ -47,7 +47,6 @@ impl AccountScope { const ENCODE : percent_encoding::AsciiSet = percent_encoding::NON_ALPHANUMERIC.remove(b':'); - let mut out = String::new(); match &self { AS::Server => { f("server")?; diff --git a/src/api.rs b/src/api.rs index 787c01e4..2d575a42 100644 --- a/src/api.rs +++ b/src/api.rs @@ -124,7 +124,7 @@ fn api_piece_op(form : Json>) let gs = &mut g.gs; let ipieces = &g.ipieces; let iplayers = &g.iplayers; - let ipl = &iplayers.byid(player)?.ipl; + let _ = iplayers.byid(player)?; let _ = gs.players.byid(player)?; let lens = TransparentLens { }; let piece = lens.decode_visible_pieceid(form.piece, player); @@ -227,7 +227,7 @@ impl ApiPieceOp for ApiPieceWrest { #[throws(ApiPieceOpError)] fn op(&self, a: ApiPieceOpArgs) -> PieceUpdateFromOp { - let ApiPieceOpArgs { gs,player,piece,p,lens,iplayers, .. } = a; + let ApiPieceOpArgs { gs,player,piece,p,lens, .. } = a; let gpl = gs.players.byid(player)?; let pc = gs.pieces.byid_mut(piece)?; let pcs = p.describe_pri(&lens.log_pri(piece, pc)).0; @@ -296,7 +296,7 @@ fn api_raise(form : Json>) impl ApiPieceOp for ApiPieceRaise { #[throws(ApiPieceOpError)] fn op(&self, a: ApiPieceOpArgs) -> PieceUpdateFromOp { - let ApiPieceOpArgs { gs,player,piece,p,lens, .. } = a; + let ApiPieceOpArgs { gs,piece, .. } = a; let pc = gs.pieces.byid_mut(piece).unwrap(); pc.zlevel = ZLevel { z : self.z.clone(), zg : gs.gen }; let update = PieceUpdateOp::SetZLevel(()); @@ -315,7 +315,7 @@ fn api_move(form : Json>) -> impl response::Responder<'st impl ApiPieceOp for ApiPieceMove { #[throws(ApiPieceOpError)] fn op(&self, a: ApiPieceOpArgs) -> PieceUpdateFromOp { - let ApiPieceOpArgs { gs,player,piece,p,lens, .. } = a; + let ApiPieceOpArgs { gs,piece, .. } = a; let pc = gs.pieces.byid_mut(piece).unwrap(); let (pos, clamped) = self.0.clamped(gs.table_size); let logents = vec![]; diff --git a/src/cmdlistener.rs b/src/cmdlistener.rs index 75aaa825..6d5de588 100644 --- a/src/cmdlistener.rs +++ b/src/cmdlistener.rs @@ -109,7 +109,7 @@ fn execute(cs: &mut CommandStream, cmd: MgmtCommand) -> MgmtResponse { let mut ag = AccountsGuard::lock(); let auth = authorise_for_account(cs, &ag, &account)?; let access = access.map(Into::into); - ag.with_entry_mut(&account, auth, access, |record, acctid|{ + ag.with_entry_mut(&account, auth, access, |record, _acctid|{ fn update_from(spec: Option, record: &mut T) { if let Some(new) = spec { *record = new; } } @@ -278,7 +278,7 @@ fn execute_game_insn<'ig>( } let y = match update { - Noop { } => readonly(cs,ag,ig, &[], |ig| Ok(Fine))?, + Noop { } => readonly(cs,ag,ig, &[], |_| Ok(Fine))?, Insn::SetTableSize(size) => { let ig = cs.check_acl(ag, ig, PCH::Instance, &[TP::ChangePieces])?.0; @@ -298,7 +298,7 @@ fn execute_game_insn<'ig>( } => { // todo some kind of permissions check for player too let ig = cs.check_acl(ag, ig, PCH::Instance, &[TP::AddPlayer])?.0; - let (record, acctid) = ag.lookup(&account)?; + let (_arecord, acctid) = ag.lookup(&account)?; let nick = nick.ok_or(ME::ParameterMissing)?; let logentry = LogEntry { html: Html(format!("{} added a player: {}", &who, @@ -349,7 +349,7 @@ fn execute_game_insn<'ig>( RemovePlayer { player } => { let ig = cs.check_acl_modify_player(ag, ig, player, &[TP::RemovePlayer])?.0; - let (gpl, ipl) = ig.player_remove(player)?; + let (gpl, _ipl) = ig.player_remove(player)?; let show = if let Some(gpl) = gpl { htmlescape::encode_minimal(&gpl.nick) } else { @@ -398,7 +398,7 @@ fn execute_game_insn<'ig>( if_chain! { if let Some(ipr) = ig.iplayers.get(player); let ipl = &ipr.ipl; - if let Ok((arecord, acctid)) = ag.lookup(ipl.acctid); + if let Ok((arecord, _)) = ag.lookup(ipl.acctid); then { Ok((player, MgmtPlayerInfo { account: (*arecord.account).clone(), nick, @@ -765,9 +765,9 @@ impl CommandStream<'_> { ) -> (&'ig mut InstanceGuard<'ig>, Authorisation) { - let (ipl_unauth, gpl_unauth) = { + let ipl_unauth = { let ig = ig.by(Authorisation::authorise_any()); - (ig.iplayers.byid(player)?, ig.gs.players.byid(player)?) + ig.iplayers.byid(player)? }; let how = PCH::InstanceOrOnlyAffectedAccount(ipl_unauth.ipl.acctid); let (ig, auth) = self.check_acl(ag, ig, how, p)?; @@ -1008,10 +1008,10 @@ mod authproofs { pub struct Authorisation (PhantomData); impl Authorisation { - pub const fn authorised(v: &T) -> Authorisation { + pub const fn authorised(_v: &T) -> Authorisation { Authorisation(PhantomData) } - pub fn map(self, f: fn(&T) -> &U) -> Authorisation { + pub fn map(self, _f: fn(&T) -> &U) -> Authorisation { self.therefore_ok() } pub fn therefore_ok(self) -> Authorisation { diff --git a/src/spec.rs b/src/spec.rs index e620d3fa..f654f1e5 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -278,15 +278,15 @@ pub mod implementation { None } fn server_deliver<'t>(&self, - gpl: &GPlayerState, - ipl: &IPlayerState, - token: &'t AccessTokenReport) + _gpl: &GPlayerState, + _ipl: &IPlayerState, + _token: &'t AccessTokenReport) -> Result, TDE> { Ok(None) } fn client_deliver(&self, - pi: &MgmtPlayerInfo, - token: &AccessTokenReport) + _pi: &MgmtPlayerInfo, + _token: &AccessTokenReport) -> Result<(), TDE> { panic!() } @@ -311,8 +311,8 @@ pub mod implementation { impl PlayerAccessSpec for UrlOnStdout { #[throws(TDE)] fn server_deliver<'t>(&self, - gpl: &GPlayerState, - ipl: &IPlayerState, + _gpl: &GPlayerState, + _ipl: &IPlayerState, token: &'t AccessTokenReport) -> Option<&'t AccessTokenReport> { Some(token)