diff --git a/Cargo.toml b/Cargo.toml index 33d03174..d57df21b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,14 @@ members = [ "sulis_view", ] +[workspace.lints.clippy] +assigning_clones = "allow" +type_complexity = "allow" +map_clone = "allow" +collapsible_else_if = "allow" +collapsible_if = "allow" +manual_range_contains = "allow" + [workspace.dependencies] base64 = "0.21" chrono = "0.4" diff --git a/sulis_core/Cargo.toml b/sulis_core/Cargo.toml index 00f7c1af..5cbd6728 100644 --- a/sulis_core/Cargo.toml +++ b/sulis_core/Cargo.toml @@ -4,6 +4,9 @@ version = "1.0.0" authors = ["Jared Stephen "] edition = "2021" +[lints] +workspace = true + [dependencies] home = { workspace = true } flexi_logger = { workspace = true } diff --git a/sulis_core/src/config.rs b/sulis_core/src/config.rs index 91acd4ef..f9a737ab 100644 --- a/sulis_core/src/config.rs +++ b/sulis_core/src/config.rs @@ -447,7 +447,7 @@ impl Config { }; for key in RawClick::iter() { - if config.input.click_actions.get(key).is_none() { + if !config.input.click_actions.contains_key(key) { return Err(Error::new( ErrorKind::InvalidData, "Must specify an action for each of Left, Right & Middle Click", diff --git a/sulis_core/src/io/glium_adapter.rs b/sulis_core/src/io/glium_adapter.rs index 6d460295..d044c537 100644 --- a/sulis_core/src/io/glium_adapter.rs +++ b/sulis_core/src/io/glium_adapter.rs @@ -141,7 +141,7 @@ impl<'a> GliumRenderer<'a> { } fn create_texture_if_missing(&mut self, texture_id: &str, draw_list: &DrawList) { - if self.display.textures.get(texture_id).is_some() { + if self.display.textures.contains_key(texture_id) { return; } diff --git a/sulis_core/src/lib.rs b/sulis_core/src/lib.rs index 9b42cf06..1067f7fe 100644 --- a/sulis_core/src/lib.rs +++ b/sulis_core/src/lib.rs @@ -14,8 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Sulis. If not, see -#![allow(clippy::type_complexity)] - pub extern crate serde; pub extern crate serde_json; pub extern crate serde_yaml; diff --git a/sulis_core/src/resource.rs b/sulis_core/src/resource.rs index 6e0dac13..b44c32f4 100644 --- a/sulis_core/src/resource.rs +++ b/sulis_core/src/resource.rs @@ -354,7 +354,6 @@ pub fn all_resources(map: &HashMap>) -> Vec> { } pub fn get_resource(id: &str, map: &HashMap>) -> Option> { - #[allow(clippy::map_clone)] map.get(id).map(Rc::clone) } diff --git a/sulis_editor/Cargo.toml b/sulis_editor/Cargo.toml index b33d29f6..05f395e8 100644 --- a/sulis_editor/Cargo.toml +++ b/sulis_editor/Cargo.toml @@ -4,6 +4,9 @@ version = "1.0.0" authors = ["Jared Stephen "] edition = "2021" +[lints] +workspace = true + [dependencies] sulis_core = { path = "../sulis_core" } sulis_module = { path = "../sulis_module" } diff --git a/sulis_editor/src/lib.rs b/sulis_editor/src/lib.rs index 265e68f9..a138c4ff 100644 --- a/sulis_editor/src/lib.rs +++ b/sulis_editor/src/lib.rs @@ -14,9 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Sulis. If not, see -#![allow(clippy::type_complexity)] -#![allow(clippy::manual_range_contains)] - mod actor_picker; use crate::actor_picker::ActorPicker; diff --git a/sulis_module/Cargo.toml b/sulis_module/Cargo.toml index 42511aac..2846c3c1 100644 --- a/sulis_module/Cargo.toml +++ b/sulis_module/Cargo.toml @@ -4,6 +4,9 @@ version = "1.0.0" authors = ["Jared Stephen "] edition = "2021" +[lints] +workspace = true + [dependencies] sulis_core = { path = "../sulis_core" } diff --git a/sulis_module/src/generator/encounter_gen.rs b/sulis_module/src/generator/encounter_gen.rs index f0bc10b3..94ba1a2c 100644 --- a/sulis_module/src/generator/encounter_gen.rs +++ b/sulis_module/src/generator/encounter_gen.rs @@ -154,7 +154,6 @@ impl EncounterParams { module: &Module, ) -> Result { EncounterParams::build(builder, |id| { - #[allow(clippy::map_clone)] module.encounters.get(id).map(Rc::clone) }) } diff --git a/sulis_module/src/lib.rs b/sulis_module/src/lib.rs index 49acf9f5..3a45c74e 100644 --- a/sulis_module/src/lib.rs +++ b/sulis_module/src/lib.rs @@ -14,9 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Sulis. If not, see -#![allow(clippy::manual_range_contains)] -#![allow(clippy::map_clone)] - #[macro_use] extern crate log; diff --git a/sulis_module/src/loot_list.rs b/sulis_module/src/loot_list.rs index 54ed9d73..7a8c34cf 100644 --- a/sulis_module/src/loot_list.rs +++ b/sulis_module/src/loot_list.rs @@ -142,7 +142,7 @@ impl LootList { id: String, entry_in: EntryBuilder, ) -> Result { - if module.items.get(&id).is_none() { + if !module.items.contains_key(&id) { warn!("Unable to find item '{}'", id); return unable_to_create_error("loot_list", builder_id); } @@ -159,7 +159,7 @@ impl LootList { if id == "none" { continue; } - if module.item_adjectives.get(&id).is_none() { + if !module.item_adjectives.contains_key(&id) { warn!("Unable to find item adjective '{}'", id); return unable_to_create_error("loot_list", builder_id); } @@ -173,7 +173,7 @@ impl LootList { if id == "none" { continue; } - if module.item_adjectives.get(&id).is_none() { + if !module.item_adjectives.contains_key(&id) { warn!("Unable to find item adjective '{}'", id); return unable_to_create_error("loot_list", builder_id); } diff --git a/sulis_state/Cargo.toml b/sulis_state/Cargo.toml index 9f7fed2a..6b2eb573 100644 --- a/sulis_state/Cargo.toml +++ b/sulis_state/Cargo.toml @@ -4,6 +4,9 @@ version = "1.0.0" authors = ["Jared Stephen "] edition = "2021" +[lints] +workspace = true + [dependencies] sulis_core = { path = "../sulis_core" } sulis_module = { path = "../sulis_module" } diff --git a/sulis_state/src/game_state.rs b/sulis_state/src/game_state.rs index 2cc76fd9..42792f40 100644 --- a/sulis_state/src/game_state.rs +++ b/sulis_state/src/game_state.rs @@ -924,7 +924,6 @@ impl GameState { } pub fn get_area_state(id: &str) -> Option>> { - #[allow(clippy::map_clone)] STATE.with(|s| s.borrow().as_ref().unwrap().areas.get(id).map(Rc::clone)) } diff --git a/sulis_state/src/inventory.rs b/sulis_state/src/inventory.rs index 08f4e1c1..58e9e5e1 100644 --- a/sulis_state/src/inventory.rs +++ b/sulis_state/src/inventory.rs @@ -374,13 +374,13 @@ impl Inventory { if to_remove_primary.is_some() { primary_count += 1; } - if self.equipped.get(&slot).is_some() { + if self.equipped.contains_key(&slot) { primary_count += 1; } if to_remove_alt.is_some() { alt_count += 1; } - if self.equipped.get(&alt_slot).is_some() { + if self.equipped.contains_key(&alt_slot) { alt_count += 1; } diff --git a/sulis_state/src/lib.rs b/sulis_state/src/lib.rs index 9d92f9f4..b9594cd6 100644 --- a/sulis_state/src/lib.rs +++ b/sulis_state/src/lib.rs @@ -14,9 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Sulis. If not, see -#![allow(clippy::type_complexity)] -#![allow(clippy::map_clone)] - #[macro_use] extern crate log; diff --git a/sulis_state/src/los_calculator.rs b/sulis_state/src/los_calculator.rs index 83d7997a..4f32dde4 100644 --- a/sulis_state/src/los_calculator.rs +++ b/sulis_state/src/los_calculator.rs @@ -140,7 +140,6 @@ fn cast_ray( end_y: i32, src_elev: u8, ) -> bool { - #[allow(clippy::collapsible_else_if)] // this block is logically easier to read when not collapsed if (end_y - start_y).abs() < (end_x - start_x).abs() { if start_x > end_x { cast_low( diff --git a/sulis_state/src/script/area_targeter.rs b/sulis_state/src/script/area_targeter.rs index f28a6712..36abecdc 100644 --- a/sulis_state/src/script/area_targeter.rs +++ b/sulis_state/src/script/area_targeter.rs @@ -428,7 +428,6 @@ impl Shape { points } - #[allow(clippy::collapsible_if)] fn get_points_line_internal( &self, start: Point, @@ -445,7 +444,6 @@ impl Shape { Some(size) => size, }; - #[allow(clippy::collapsible_else_if)] // this block is logically easier to read when not collapsed let (points, concat) = if (end.y - start.y).abs() < (end.x - start.x).abs() { if start.x > end.x { let mut p = cast_low(end, start); diff --git a/sulis_state/src/script/script_callback.rs b/sulis_state/src/script/script_callback.rs index 0eae8dde..eea1e5c9 100644 --- a/sulis_state/src/script/script_callback.rs +++ b/sulis_state/src/script/script_callback.rs @@ -533,7 +533,7 @@ impl CallbackData { } fn exec_surface_script(&self, kind: FuncKind, target: Option) { - if self.funcs.get(&kind).is_none() { + if !self.funcs.contains_key(&kind) { return; } @@ -611,7 +611,7 @@ impl ScriptCallback for CallbackData { fn on_exited_surface(&self, target: usize) { // since it is called after the surface has been removed in some cases // we cannot preserve the surface info for on_exited_surface scripts - if self.funcs.get(&FuncKind::OnExitedSurface).is_none() { + if !self.funcs.contains_key(&FuncKind::OnExitedSurface) { return; } diff --git a/sulis_state/src/script/script_entity.rs b/sulis_state/src/script/script_entity.rs index cccb2b40..6c070079 100644 --- a/sulis_state/src/script/script_entity.rs +++ b/sulis_state/src/script/script_entity.rs @@ -1203,7 +1203,6 @@ impl UserData for ScriptEntity { Ok(()) }); - #[allow(clippy::type_complexity)] methods.add_method( "special_attack", |_, diff --git a/sulis_view/Cargo.toml b/sulis_view/Cargo.toml index 9ce9f8d5..e3a8dc64 100644 --- a/sulis_view/Cargo.toml +++ b/sulis_view/Cargo.toml @@ -4,6 +4,9 @@ version = "1.0.0" authors = ["Jared Stephen "] edition = "2021" +[lints] +workspace = true + [dependencies] sulis_core = { path = "../sulis_core" } sulis_module = { path = "../sulis_module" }