From 56f08a88aa690ad0a5edd9bdc340434c8c0b9d6b Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Sat, 10 Aug 2024 13:34:13 +0200 Subject: [PATCH] Fix new clippy lints --- crates/lune-roblox/src/instance/data_model.rs | 6 +-- crates/lune-roblox/src/instance/mod.rs | 40 +++++++++---------- crates/lune-roblox/src/instance/terrain.rs | 4 +- crates/lune-roblox/src/instance/workspace.rs | 4 +- crates/lune-std-net/src/server/request.rs | 2 + crates/lune-std-process/src/lib.rs | 4 +- crates/lune-std-stdio/src/prompt.rs | 6 +-- 7 files changed, 34 insertions(+), 32 deletions(-) diff --git a/crates/lune-roblox/src/instance/data_model.rs b/crates/lune-roblox/src/instance/data_model.rs index cfbc9d5..80003c1 100644 --- a/crates/lune-roblox/src/instance/data_model.rs +++ b/crates/lune-roblox/src/instance/data_model.rs @@ -26,7 +26,7 @@ pub fn add_methods<'lua, M: LuaUserDataMethods<'lua, Instance>>(m: &mut M) { ### See Also * [`Terrain`](https://create.roblox.com/docs/reference/engine/classes/Workspace#Terrain) - on the Roblox Developer Hub + on the Roblox Developer Hub */ fn data_model_get_workspace(_: &Lua, this: &Instance) -> LuaResult { get_or_create_property_ref_instance(this, "Workspace", "Workspace") @@ -37,7 +37,7 @@ fn data_model_get_workspace(_: &Lua, this: &Instance) -> LuaResult { ### See Also * [`GetService`](https://create.roblox.com/docs/reference/engine/classes/ServiceProvider#GetService) - on the Roblox Developer Hub + on the Roblox Developer Hub */ fn data_model_get_service(_: &Lua, this: &Instance, service_name: String) -> LuaResult { if matches!(class_is_a_service(&service_name), None | Some(false)) { @@ -58,7 +58,7 @@ fn data_model_get_service(_: &Lua, this: &Instance, service_name: String) -> Lua ### See Also * [`FindService`](https://create.roblox.com/docs/reference/engine/classes/ServiceProvider#FindService) - on the Roblox Developer Hub + on the Roblox Developer Hub */ fn data_model_find_service( _: &Lua, diff --git a/crates/lune-roblox/src/instance/mod.rs b/crates/lune-roblox/src/instance/mod.rs index 99bd16b..3397e09 100644 --- a/crates/lune-roblox/src/instance/mod.rs +++ b/crates/lune-roblox/src/instance/mod.rs @@ -170,7 +170,7 @@ impl Instance { ### See Also * [`Clone`](https://create.roblox.com/docs/reference/engine/classes/Instance#Clone) - on the Roblox Developer Hub + on the Roblox Developer Hub */ #[must_use] pub fn clone_instance(&self) -> Self { @@ -194,7 +194,7 @@ impl Instance { ### See Also * [`Destroy`](https://create.roblox.com/docs/reference/engine/classes/Instance#Destroy) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn destroy(&mut self) -> bool { if self.is_destroyed() { @@ -221,7 +221,7 @@ impl Instance { ### See Also * [`Instance::Destroy`] for more info about what happens when an instance gets destroyed * [`ClearAllChildren`](https://create.roblox.com/docs/reference/engine/classes/Instance#ClearAllChildren) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn clear_all_children(&mut self) { let mut dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -241,7 +241,7 @@ impl Instance { ### See Also * [`IsA`](https://create.roblox.com/docs/reference/engine/classes/Instance#IsA) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn is_a(&self, class_name: impl AsRef) -> bool { class_is_a(&self.class_name, class_name).unwrap_or(false) @@ -254,7 +254,7 @@ impl Instance { ### See Also * [`ClassName`](https://create.roblox.com/docs/reference/engine/classes/Instance#ClassName) - on the Roblox Developer Hub + on the Roblox Developer Hub */ #[must_use] pub fn get_class_name(&self) -> &str { @@ -266,7 +266,7 @@ impl Instance { ### See Also * [`Name`](https://create.roblox.com/docs/reference/engine/classes/Instance#Name) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn get_name(&self) -> String { let dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -282,7 +282,7 @@ impl Instance { ### See Also * [`Name`](https://create.roblox.com/docs/reference/engine/classes/Instance#Name) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn set_name(&self, name: impl Into) { let mut dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -297,7 +297,7 @@ impl Instance { ### See Also * [`Parent`](https://create.roblox.com/docs/reference/engine/classes/Instance#Parent) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn get_parent(&self) -> Option { let dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -324,7 +324,7 @@ impl Instance { ### See Also * [`Parent`](https://create.roblox.com/docs/reference/engine/classes/Instance#Parent) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn set_parent(&self, parent: Option) { let mut dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -369,7 +369,7 @@ impl Instance { ### See Also * [`GetAttribute`](https://create.roblox.com/docs/reference/engine/classes/Instance#GetAttribute) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn get_attribute(&self, name: impl AsRef) -> Option { let dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -390,7 +390,7 @@ impl Instance { ### See Also * [`GetAttributes`](https://create.roblox.com/docs/reference/engine/classes/Instance#GetAttributes) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn get_attributes(&self) -> BTreeMap { let dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -411,7 +411,7 @@ impl Instance { ### See Also * [`SetAttribute`](https://create.roblox.com/docs/reference/engine/classes/Instance#SetAttribute) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn set_attribute(&self, name: impl AsRef, value: DomValue) { let mut dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -466,7 +466,7 @@ impl Instance { ### See Also * [`AddTag`](https://create.roblox.com/docs/reference/engine/classes/CollectionService#AddTag) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn add_tag(&self, name: impl AsRef) { let mut dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -488,7 +488,7 @@ impl Instance { ### See Also * [`GetTags`](https://create.roblox.com/docs/reference/engine/classes/CollectionService#GetTags) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn get_tags(&self) -> Vec { let dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -507,7 +507,7 @@ impl Instance { ### See Also * [`HasTag`](https://create.roblox.com/docs/reference/engine/classes/CollectionService#HasTag) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn has_tag(&self, name: impl AsRef) -> bool { let dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -527,7 +527,7 @@ impl Instance { ### See Also * [`RemoveTag`](https://create.roblox.com/docs/reference/engine/classes/CollectionService#RemoveTag) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn remove_tag(&self, name: impl AsRef) { let mut dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -553,7 +553,7 @@ impl Instance { ### See Also * [`GetChildren`](https://create.roblox.com/docs/reference/engine/classes/Instance#GetChildren) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn get_children(&self) -> Vec { let dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -576,7 +576,7 @@ impl Instance { ### See Also * [`GetDescendants`](https://create.roblox.com/docs/reference/engine/classes/Instance#GetDescendants) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn get_descendants(&self) -> Vec { let dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -610,7 +610,7 @@ impl Instance { ### See Also * [`GetFullName`](https://create.roblox.com/docs/reference/engine/classes/Instance#GetFullName) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn get_full_name(&self) -> String { let dom = INTERNAL_DOM.lock().expect("Failed to lock document"); @@ -700,7 +700,7 @@ impl Instance { ### See Also * [`FindFirstDescendant`](https://create.roblox.com/docs/reference/engine/classes/Instance#FindFirstDescendant) - on the Roblox Developer Hub + on the Roblox Developer Hub */ pub fn find_descendant(&self, predicate: F) -> Option where diff --git a/crates/lune-roblox/src/instance/terrain.rs b/crates/lune-roblox/src/instance/terrain.rs index 852f321..96a036b 100644 --- a/crates/lune-roblox/src/instance/terrain.rs +++ b/crates/lune-roblox/src/instance/terrain.rs @@ -40,7 +40,7 @@ fn get_or_create_material_colors(instance: &Instance) -> MaterialColors { ### See Also * [`GetMaterialColor`](https://create.roblox.com/docs/reference/engine/classes/Terrain#GetMaterialColor) - on the Roblox Developer Hub + on the Roblox Developer Hub */ fn terrain_get_material_color(_: &Lua, this: &Instance, material: EnumItem) -> LuaResult { let material_colors = get_or_create_material_colors(this); @@ -65,7 +65,7 @@ fn terrain_get_material_color(_: &Lua, this: &Instance, material: EnumItem) -> L ### See Also * [`SetMaterialColor`](https://create.roblox.com/docs/reference/engine/classes/Terrain#SetMaterialColor) - on the Roblox Developer Hub + on the Roblox Developer Hub */ fn terrain_set_material_color( _: &Lua, diff --git a/crates/lune-roblox/src/instance/workspace.rs b/crates/lune-roblox/src/instance/workspace.rs index 70f1b88..f11cd8d 100644 --- a/crates/lune-roblox/src/instance/workspace.rs +++ b/crates/lune-roblox/src/instance/workspace.rs @@ -16,7 +16,7 @@ pub fn add_fields<'lua, F: LuaUserDataFields<'lua, Instance>>(f: &mut F) { ### See Also * [`Terrain`](https://create.roblox.com/docs/reference/engine/classes/Workspace#Terrain) - on the Roblox Developer Hub + on the Roblox Developer Hub */ fn workspace_get_terrain(_: &Lua, this: &Instance) -> LuaResult { get_or_create_property_ref_instance(this, "Terrain", "Terrain") @@ -27,7 +27,7 @@ fn workspace_get_terrain(_: &Lua, this: &Instance) -> LuaResult { ### See Also * [`CurrentCamera`](https://create.roblox.com/docs/reference/engine/classes/Workspace#CurrentCamera) - on the Roblox Developer Hub + on the Roblox Developer Hub */ fn workspace_get_camera(_: &Lua, this: &Instance) -> LuaResult { get_or_create_property_ref_instance(this, "CurrentCamera", "Camera") diff --git a/crates/lune-std-net/src/server/request.rs b/crates/lune-std-net/src/server/request.rs index f3de802..e5eaf8d 100644 --- a/crates/lune-std-net/src/server/request.rs +++ b/crates/lune-std-net/src/server/request.rs @@ -18,6 +18,7 @@ impl LuaRequest { let path = self.head.uri.path().to_string(); let body = lua.create_string(&self.body)?; + #[allow(clippy::mutable_key_type)] let query: HashMap = self .head .uri @@ -32,6 +33,7 @@ impl LuaRequest { }) .collect::>()?; + #[allow(clippy::mutable_key_type)] let headers: HashMap = self .head .headers diff --git a/crates/lune-std-process/src/lib.rs b/crates/lune-std-process/src/lib.rs index d3fd502..29d73ea 100644 --- a/crates/lune-std-process/src/lib.rs +++ b/crates/lune-std-process/src/lib.rs @@ -42,8 +42,8 @@ pub fn module(lua: &Lua) -> LuaResult { cwd_str.push(MAIN_SEPARATOR); } // Create constants for OS & processor architecture - let os = lua.create_string(&OS.to_lowercase())?; - let arch = lua.create_string(&ARCH.to_lowercase())?; + let os = lua.create_string(OS.to_lowercase())?; + let arch = lua.create_string(ARCH.to_lowercase())?; // Create readonly args array let args_vec = lua .app_data_ref::>() diff --git a/crates/lune-std-stdio/src/prompt.rs b/crates/lune-std-stdio/src/prompt.rs index e1fcc02..a893544 100644 --- a/crates/lune-std-stdio/src/prompt.rs +++ b/crates/lune-std-stdio/src/prompt.rs @@ -194,14 +194,14 @@ pub fn prompt(options: PromptOptions) -> LuaResult { prompt = prompt.default(b); }; let result = prompt - .with_prompt(&options.text.expect("Missing text in prompt options")) + .with_prompt(options.text.expect("Missing text in prompt options")) .interact() .into_lua_err()?; Ok(PromptResult::Boolean(result)) } PromptKind::Select => { let chosen = Select::with_theme(&theme) - .with_prompt(&options.text.unwrap_or_default()) + .with_prompt(options.text.unwrap_or_default()) .items(&options.options.expect("Missing options in prompt options")) .interact_opt() .into_lua_err()?; @@ -212,7 +212,7 @@ pub fn prompt(options: PromptOptions) -> LuaResult { } PromptKind::MultiSelect => { let chosen = MultiSelect::with_theme(&theme) - .with_prompt(&options.text.unwrap_or_default()) + .with_prompt(options.text.unwrap_or_default()) .items(&options.options.expect("Missing options in prompt options")) .interact_opt() .into_lua_err()?;