From a0417d3d0385cf310053aa32f58551ff672076a3 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 10 Jul 2021 12:02:11 +0100 Subject: [PATCH] jstest: lower: make add_test take Vpid not &'static str Signed-off-by: Ian Jackson --- jstest/jst-lower.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jstest/jst-lower.rs b/jstest/jst-lower.rs index 8f6634ea..5dd96081 100644 --- a/jstest/jst-lower.rs +++ b/jstest/jst-lower.rs @@ -14,7 +14,7 @@ pub struct Opts { #[derive(Debug,Clone)] pub struct StartPieceSpec { - id: &'static str, + id: Vpid, pinned: bool, moveable: PieceMoveable, } @@ -22,7 +22,7 @@ pub struct StartPieceSpec { #[macro_export] macro_rules! sp { { $id:expr, $pinned:expr, $moveable:ident } => { - StartPieceSpec { id: $id, pinned: $pinned, + StartPieceSpec { id: $id.try_into().unwrap(), pinned: $pinned, moveable: PieceMoveable::$moveable } }; } @@ -241,9 +241,9 @@ impl TestsAccumulator { } #[throws(Explode)] - pub fn add_test(&mut self, name: &'static str, - pieces: Vec, - targets: Vec<&'_ str>) { + pub fn add_test(&mut self, name: &'static str, + pieces: Vec, + targets: Vec) where T: TryInto + Copy + Debug { let mut zm = ZCoord::default().clone_mut(); let pieces = pieces.into_iter().map( |StartPieceSpec { id, pinned, moveable }| { @@ -254,7 +254,7 @@ impl TestsAccumulator { ).collect(); let targets = targets.into_iter().map( - |s| s.try_into().unwrap() + |s| s.try_into().map_err(|_|s).unwrap() ).collect(); let test = Test { -- 2.30.2