Fixes a bunch of clippy warnings, adds clippy to CI
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -46,13 +46,13 @@ pub fn load_types(path: &String, type_library: &mut TypeLibrary) {
|
||||
.unwrap();
|
||||
let headers = reader.headers().unwrap();
|
||||
for header in headers.iter().skip(1) {
|
||||
type_library.register_type(&StringKey::new(header.clone()));
|
||||
type_library.register_type(&StringKey::new(header));
|
||||
}
|
||||
|
||||
for record in reader.records() {
|
||||
let record = record.unwrap();
|
||||
let offensive_type = record.get(0).unwrap();
|
||||
let offensive_type_id = type_library.get_type_id(&StringKey::new(offensive_type.clone()));
|
||||
let offensive_type_id = type_library.get_type_id(&StringKey::new(offensive_type));
|
||||
|
||||
for (i, v) in record.iter().skip(1).enumerate() {
|
||||
let effectiveness = v.parse::<f32>().unwrap();
|
||||
@@ -166,7 +166,7 @@ pub fn load_moves(path: &String, lib: &mut StaticData) {
|
||||
let data = json.as_object().unwrap().get("data").unwrap().as_array().unwrap();
|
||||
for move_data in data {
|
||||
let move_data = move_data.as_object().unwrap();
|
||||
let move_name = StringKey::new(move_data["name"].as_str().unwrap().clone());
|
||||
let move_name = StringKey::new(move_data["name"].as_str().unwrap());
|
||||
let move_type = StringKey::new(move_data["type"].as_str().unwrap());
|
||||
let move_type_id = lib.types().get_type_id(&move_type);
|
||||
let move_category = serde_json::from_value(move_data["category"].clone()).unwrap();
|
||||
@@ -188,7 +188,7 @@ pub fn load_moves(path: &String, lib: &mut StaticData) {
|
||||
}
|
||||
}
|
||||
|
||||
SecondaryEffect::new(chance, StringKey::new(v["name"].as_str().unwrap().clone()), parameters)
|
||||
SecondaryEffect::new(chance, StringKey::new(v["name"].as_str().unwrap()), parameters)
|
||||
} else {
|
||||
SecondaryEffect::empty()
|
||||
};
|
||||
@@ -227,7 +227,7 @@ pub fn load_species(path: &String, library: &mut StaticData) {
|
||||
let o = json.as_object().unwrap();
|
||||
|
||||
for (key, value) in o {
|
||||
if key.starts_with("$") {
|
||||
if key.starts_with('$') {
|
||||
continue;
|
||||
}
|
||||
let name = StringKey::new(key);
|
||||
@@ -393,7 +393,7 @@ fn test_type_library_loaded() {
|
||||
assert_eq!(
|
||||
lib.get_effectiveness(
|
||||
lib.get_type_id(&StringKey::new("fire")),
|
||||
&vec![lib.get_type_id(&StringKey::new("grass"))],
|
||||
&[lib.get_type_id(&StringKey::new("grass"))],
|
||||
),
|
||||
2.0
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user