From: Ian Jackson Date: Thu, 31 Mar 2022 00:27:10 +0000 (+0100) Subject: clippy: Miscellaneous minor changes X-Git-Tag: otter-1.0.0~49 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c350dc5b18aca92ecc3060e901513ca1a9675f9b;p=otter.git clippy: Miscellaneous minor changes Signed-off-by: Ian Jackson --- diff --git a/src/deck.rs b/src/deck.rs index 95e077e1..216dbcd2 100644 --- a/src/deck.rs +++ b/src/deck.rs @@ -74,7 +74,7 @@ impl PieceSpec for piece_specs::Deck { impl Deck { #[throws(IE)] fn state(&self, gpc: &GPiece, goccults: &GameOccults) -> State { - match gpc.occult.active_views(&goccults)? { + match gpc.occult.active_views(goccults)? { None => Disabled, Some(OccultationViews { defview: OccK::Visible,.. }) => Counting, Some(OccultationViews { defview: OccK::Scrambled /*old*/,.. }) | @@ -85,10 +85,10 @@ impl Deck { #[throws(IE)] fn current_face(&self, gpc: &GPiece, goccults: &GameOccults) -> FaceId { - RawFaceId::from(match self.state(gpc, goccults)? { + RawFaceId::into(match self.state(gpc, goccults)? { Disabled | Counting => 0, Enabled => 1, - }).into() + }) } } @@ -180,7 +180,7 @@ impl PieceTrait for Deck { dbgc!("ui op k entry", &opname); let rot_checked = gpc.occulter_check_unrotated(vis)?; - let old_state = self.state(gpc, &goccults)?; + let old_state = self.state(gpc, goccults)?; let (new_state, did) = match opname { "activate" => (Enabled, hformat!("enabled {}", CORE_DESC)), diff --git a/src/error.rs b/src/error.rs index 72049834..b3d5a031 100644 --- a/src/error.rs +++ b/src/error.rs @@ -194,8 +194,12 @@ pub enum AggregatedIE { Many, } +impl Default for AggregatedIE { + fn default() -> Self { Self::Ok } +} + impl AggregatedIE { - pub fn new() -> Self { Self::Ok } + pub fn new() -> Self { default() } pub fn handle(&mut self, r: Result) -> Option { match r {