From: Ian Jackson Date: Fri, 15 Apr 2022 17:23:27 +0000 (+0100) Subject: Move fn load out of SimplePieceSpec into macro X-Git-Tag: otter-1.1.0~601 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e2cb1a30dae57cc149c244f89dbb8242d2b3f10c;p=otter.git Move fn load out of SimplePieceSpec into macro The only call site was in impl_PieceSpec_for_SimplePieceSpec. Hoisting it there makes little codegen difference but seems more natural. Signed-off-by: Ian Jackson --- diff --git a/src/pieces.rs b/src/pieces.rs index 9d9d7b78..37297dc8 100644 --- a/src/pieces.rs +++ b/src/pieces.rs @@ -309,13 +309,6 @@ impl GenericSimpleShape #[typetag::serde(tag="type")] pub trait SimplePieceSpec: Debug { fn load_raw(&self) -> Result<(SimpleShape, &SimpleCommon), SpecError>; - #[throws(SpecError)] - fn load(&self) -> PieceSpecLoaded { - PieceSpecLoaded { - p: Box::new(self.load_raw()?.0), - occultable: None, - } - } } #[typetag::serde] @@ -367,7 +360,10 @@ macro_rules! impl_PieceSpec_for_SimplePieceSpec { { $ty:ty } => { #[throws(SpecError)] fn load(&self, _: usize, _: &mut GPiece, _ig: &Instance, _:SpecDepth) -> PieceSpecLoaded { - SimplePieceSpec::load(self)? + PieceSpecLoaded { + p: Box::new(self.load_raw()?.0), + occultable: None, + } } } } }