From cf29fd43dc0fd421b1a027cb51eba29c3fc9fc86 Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Wed, 1 Jul 2020 16:23:28 +0100 Subject: [PATCH] tidy up bitsy-validate --- README.md | 10 ++++------ src/bin/bitsy-validate.rs | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index af1837c..b4d3e91 100644 --- a/README.md +++ b/README.md @@ -17,13 +17,11 @@ extern crate bitsy_parser; use bitsy_parser::game::Game; use std::{env, fs}; +const SYNTAX_ERROR: &str = "No input path specified. Usage: `bitsy-validate filepath`"; + fn main() { - let input_file = env::args() - .nth(1) - .expect("No input path specified. Usage: `bitsy-validate filepath`"); - - Game::from(fs::read_to_string(input_file).unwrap()).unwrap(); - + let input = env::args().nth(1).expect(SYNTAX_ERROR); + Game::from(fs::read_to_string(input).unwrap()).unwrap(); println!("OK!"); } ``` diff --git a/src/bin/bitsy-validate.rs b/src/bin/bitsy-validate.rs index ba9c833..b8a4f1e 100644 --- a/src/bin/bitsy-validate.rs +++ b/src/bin/bitsy-validate.rs @@ -5,7 +5,7 @@ use std::{env, fs}; const SYNTAX_ERROR: &str = "No input path specified. Usage: `bitsy-validate filepath`"; fn main() { - let input_file = env::args().nth(1).expect(SYNTAX_ERROR); - Game::from(fs::read_to_string(input_file).unwrap()).unwrap(); + let input = env::args().nth(1).expect(SYNTAX_ERROR); + Game::from(fs::read_to_string(input).unwrap()).unwrap(); println!("OK!"); }