From ed6552f39c86700700e06f7941b1cb5f23600556 Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Sat, 25 Apr 2020 14:18:34 +0100 Subject: [PATCH] debug messages for bad position data --- src/position.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/position.rs b/src/position.rs index 717378d..c24e190 100644 --- a/src/position.rs +++ b/src/position.rs @@ -10,13 +10,13 @@ impl Position { pub(crate) fn from(string: String) -> Result { // e.g. "2,5" let xy: Vec<&str> = string.split(',').collect(); - let x = xy[0].parse().unwrap(); + let x = xy[0].parse().expect("Bad x coordinate supplied for Position"); if xy.len() < 2 { panic!("Bad position : {}", string); } - let y = xy[1].parse().unwrap(); + let y = xy[1].parse().expect("Bad y coordinate supplied for Position"); Ok(Position { x, y }) }