From c6b34548615fd08861fbee9759229e4809c0b511 Mon Sep 17 00:00:00 2001 From: Martin Pedersen Date: Sat, 6 Jan 2024 15:42:25 +0000 Subject: [PATCH] clippy --- src/backend.rs | 3 +-- src/vmod.rs | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/backend.rs b/src/backend.rs index 19f37ce..c5d8573 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -296,10 +296,9 @@ impl LanguageServer for Backend { self.set_root_uri(root_uri.clone()).await; if root_uri.scheme() == "file" { - let mut root_uri = root_uri; self.set_config(read_config(&root_uri.to_file_path().unwrap()).await?) .await; - let mut config = self.config.read().await; + let config = self.config.read().await; if let Some(ref main_vcl_path) = config.main_vcl { if let Some(main_vcl_url) = self.read_doc_from_path(main_vcl_path, vec![]).await { diff --git a/src/vmod.rs b/src/vmod.rs index 873a412..482ea81 100644 --- a/src/vmod.rs +++ b/src/vmod.rs @@ -38,7 +38,7 @@ fn parse_vmod_func_args(serde_value_arr: &[SerdeValue]) -> Vec { .iter() .filter_map(|arg| -> Option<_> { let arg_arr = arg.as_array()?; - let input_type = arg_arr.get(0)?.as_str().unwrap(); + let input_type = arg_arr.first()?.as_str().unwrap(); let name = match arg_arr.get(1) { Some(SerdeValue::String(str)) => Some(str.to_string()), _ => None, @@ -114,7 +114,7 @@ fn parse_vmod_json_func(serde_value_arr: &[SerdeValue]) -> Result = signature_arr - .get(0) + .first() .ok_or("Missing return type field")? .as_array() .ok_or("Return type should be array")? @@ -129,7 +129,7 @@ fn parse_vmod_json_func(serde_value_arr: &[SerdeValue]) -> Result> = match ret_type { "BACKEND" => Some(Box::new(Type::Backend)), "STRING" => Some(Box::new(Type::String)), @@ -195,7 +195,7 @@ pub fn parse_vmod_json(json: &str) -> Result> { }; for row in json_parsed.iter() { - let row_type = match row.get(0) { + let row_type = match row.first() { Some(SerdeValue::String(str)) => str.as_str(), _ => continue, };