chiark / gitweb /
clippy: Miscellaneous minor changes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 31 Mar 2022 00:27:10 +0000 (01:27 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 31 Mar 2022 00:27:10 +0000 (01:27 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/deck.rs
src/error.rs

index 95e077e18c4e5cd3f7cd472dab964f972b25d202..216dbcd23338280187a5a7d5c8b086991f95c6ef 100644 (file)
@@ -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)),
index 7204983478e2f28275c84410f05555aad4ccc280..b3d5a031edca2e189259ed2b6fe947dc729f70d0 100644 (file)
@@ -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<T>(&mut self, r: Result<T, InternalError>) -> Option<T> {
     match r {