chiark / gitweb /
fastsplit: No longer have fastsplit_delete insist on pass
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 19 May 2022 20:29:40 +0000 (21:29 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 19 May 2022 23:44:22 +0000 (00:44 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/currency.rs
src/fastsplit.rs

index 948b40cc53b32e9d21284ef39c1173d9071e1bb1..c3e5aca11cb27fb2ed875c266909b31cf000734a 100644 (file)
@@ -280,7 +280,7 @@ impl PieceTrait for Banknote {
 
   OpHookThunk::Reborrow(Box::new(move |igg: &mut InstanceGuard, (_player,)| {
 
-    let (puo, uu_d) = igg.fastsplit_delete(show, tpiece, &logents)?;
+    let (puo, uu_d) = igg.fastsplit_delete(tpiece, &logents)?;
     // commitment point
   Ok((move ||{
     let ig = &mut **igg;
index 472f934016e6e09b4f2432e6b8099cd1d822d2a4..87d2b6daf7242d30067c8645be07d41331f27847 100644 (file)
@@ -167,7 +167,6 @@ impl InstanceGuard<'_> {
 
   #[throws(IE)]
   pub fn fastsplit_delete(&mut self,
-                          show: ShowUnocculted,
                           piece: PieceId,
                           #[allow(clippy::ptr_arg)]
                           _proof_that_caller_handles_logging: &Vec<LogEntry>)
@@ -180,7 +179,12 @@ impl InstanceGuard<'_> {
 
     let gpc = self.gs.pieces.get(piece).ok_or_else(missing_e)?;
     let ipc = self.ipieces.get(piece).ok_or_else(missing_e)?;
-    let _p: &Piece = ipc.p.show(show).downcast_piece()?;
+
+    // If we are merging or deleting here, presumably someone has
+    // already checked that this is appropriate wrt occultations,
+    // since we don't just do that willy-nilly and occultation will
+    // have been checked when deciding *what* to merge with.
+    let _p: &Piece = ipc.p.direct_trait_access().downcast_piece()?;
 
     let _fsid: &FastSplitId = gpc.fastsplit.as_ref()
       .ok_or_else(|| internal_error_bydebug(gpc))?;