aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs
index 395e683..47ccabd 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -10,8 +10,6 @@ extern crate reqwest;
extern crate rusttype;
extern crate termcolor;
extern crate xdg;
-#[macro_use]
-extern crate lazy_static;
use std::error::Error as StdError;
use std::fmt;
@@ -37,7 +35,7 @@ mod render;
use clap::{App, Arg, ArgMatches};
use api::{Api, Profession, Skill};
-use bt::{BuildTemplate, ExtraData, Legend, TraitChoice, Traitline};
+use bt::{BuildTemplate, ExtraData, Legend, TraitChoice, Traitline, CODE_REVENANT};
use render::RenderError;
/// The name of this application.
@@ -182,10 +180,6 @@ fn run_searching(api: &mut Api, matches: &ArgMatches) -> MainResult<BuildTemplat
.expect("clap handles missing argument");
let profession = find_profession(api, requested_profession)?;
- let prof_enum = profession
- .name
- .parse()
- .expect("Profession object has unparseable name");
let legends = matches
.values_of("legend")
@@ -196,7 +190,7 @@ fn run_searching(api: &mut Api, matches: &ArgMatches) -> MainResult<BuildTemplat
.map(Result::unwrap)
.collect::<Vec<_>>();
- let extra_data = if prof_enum == bt::Profession::Revenant {
+ let extra_data = if profession.code == CODE_REVENANT {
let mut array_legends = [Legend::None; 4];
for (i, l) in legends.iter().enumerate() {
array_legends[i] = *l;
@@ -206,7 +200,7 @@ fn run_searching(api: &mut Api, matches: &ArgMatches) -> MainResult<BuildTemplat
ExtraData::None
};
- let skills = if prof_enum != bt::Profession::Revenant {
+ let skills = if profession.code != CODE_REVENANT {
matches
.values_of("skill")
.map(Iterator::collect::<Vec<_>>)
@@ -240,7 +234,7 @@ fn run_searching(api: &mut Api, matches: &ArgMatches) -> MainResult<BuildTemplat
"got too many traitlines"
);
- let build = BuildTemplate::new(prof_enum, &skills, &traitlines, extra_data)
+ let build = BuildTemplate::new(profession, &skills, &traitlines, extra_data)
.expect("BuildTemplate could not be constructed");
Ok(build)
@@ -368,7 +362,7 @@ fn run() -> MainResult<()> {
if !matches.is_present("quiet") {
println!("Image saved in {}", filename);
}
- },
+ }
Err(RenderError::EmptyBuild) => (),
Err(err) => {
eprintln!("Image could not be rendered:");