From 7485dc72db8066cee4053830f08d6f388d00d1b2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 27 Feb 2021 19:01:11 +0000 Subject: [PATCH] centralise hand::UNCLAIMED_DESC Signed-off-by: Ian Jackson --- apitest/at-otter.rs | 2 +- src/hand.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index c73e06d6..58eb893a 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -324,7 +324,7 @@ impl Ctx { let pieces = session.pieces()?; let [hand] = pieces.into_iter() - .filter(|p| p.info["desc"] == "a hand repository") + .filter(|p| p.info["desc"] == otter::hand::UNCLAIMED_DESC) .collect::>() .into_inner().unwrap(); dbg!(hand); diff --git a/src/hand.rs b/src/hand.rs index 8359e325..e5643ea2 100644 --- a/src/hand.rs +++ b/src/hand.rs @@ -7,6 +7,8 @@ use crate::prelude::*; //use super::*; +pub const UNCLAIMED_DESC: &str = "a hand repository"; + #[derive(Debug,Clone,Serialize,Deserialize)] struct MagicOwner { player: PlayerId, @@ -76,7 +78,7 @@ impl Hand { if let Some(xdata) = xdata; if let Some(owner) = &xdata.owner; then { owner.desc.clone() } - else { Html(format!("a hand repository")) } + else { Html(UNCLAIMED_DESC.into()) } } } } -- 2.30.2