diff --git a/autogen/src/gen_gql_schema.rs b/autogen/src/gen_gql_schema.rs index 1d837001fc..b7bf85d17c 100644 --- a/autogen/src/gen_gql_schema.rs +++ b/autogen/src/gen_gql_schema.rs @@ -8,8 +8,8 @@ use schemars::schema::{ }; use tailcall::config; -static GRAPHQL_SCHEMA_FILE: &'static str = "generated/.tailcallrc.graphql"; -static DIRECTIVE_WHITELIST: [(&'static str, Entity, bool); 12] = [ +static GRAPHQL_SCHEMA_FILE: &str = "generated/.tailcallrc.graphql"; +static DIRECTIVE_WHITELIST: [(&str, Entity, bool); 12] = [ ("server", Entity::Schema, false), ("upstream", Entity::Schema, false), ("http", Entity::FieldDefinition, false), @@ -23,7 +23,7 @@ static DIRECTIVE_WHITELIST: [(&'static str, Entity, bool); 12] = [ ("expr", Entity::FieldDefinition, false), ("js", Entity::FieldDefinition, false), ]; -static OBJECT_WHITELIST: [&'static str; 18] = [ +static OBJECT_WHITELIST: [&str; 18] = [ "ExprBody", "If", "Http", @@ -124,6 +124,7 @@ impl IndentedWriter { } impl Write for IndentedWriter { + #[allow(clippy::same_item_push)] fn write(&mut self, buf: &[u8]) -> std::io::Result { let mut new_buf = vec![]; let mut extra = 0; @@ -185,10 +186,10 @@ fn write_instance_type( fn write_reference( writer: &mut IndentedWriter, - reference: &String, + reference: &str, extra_it: &mut BTreeMap, ) -> std::io::Result<()> { - let mut nm = reference.split("/").last().unwrap().to_string(); + let mut nm = reference.split('/').last().unwrap().to_string(); first_char_to_upper(&mut nm); extra_it.insert(nm.clone(), ExtraTypes::Schema); write!(writer, "{nm}") @@ -208,6 +209,7 @@ fn first_char_to_upper(name: &mut String) { } } +#[allow(clippy::too_many_arguments)] fn write_type( writer: &mut IndentedWriter, name: String, @@ -245,7 +247,7 @@ fn write_type( if let Some(arr_valid) = schema.array.clone() { write_array_validation(writer, name, *arr_valid, defs, extra_it) } else if let Some(typ) = schema.object.clone() { - if typ.properties.len() > 0 { + if !typ.properties.is_empty() { let mut name = name; first_char_to_upper(&mut name); write!(writer, "{name}")?; @@ -280,7 +282,7 @@ fn write_type( } } } - +#[allow(clippy::too_many_arguments)] fn write_field( writer: &mut IndentedWriter, name: String, @@ -290,9 +292,9 @@ fn write_field( ) -> std::io::Result<()> { write!(writer, "{name}: ")?; write_type(writer, name, schema, defs, extra_it)?; - writeln!(writer, "") + writeln!(writer) } - +#[allow(clippy::too_many_arguments)] fn write_input_type( writer: &mut IndentedWriter, name: String, @@ -386,7 +388,7 @@ fn write_input_type( Ok(()) } - +#[allow(clippy::too_many_arguments)] fn write_property( writer: &mut IndentedWriter, name: String, @@ -429,7 +431,7 @@ fn input_whitelist_lookup<'a>( None } - +#[allow(clippy::too_many_arguments)] fn write_directive( writer: &mut IndentedWriter, name: String, @@ -506,7 +508,7 @@ fn write_all_directives( Ok(()) } - +#[allow(clippy::too_many_arguments)] fn write_array_validation( writer: &mut IndentedWriter, name: String, @@ -532,7 +534,7 @@ fn write_array_validation( } write!(writer, "]") } - +#[allow(clippy::too_many_arguments)] fn write_object_validation( writer: &mut IndentedWriter, name: String, @@ -540,7 +542,7 @@ fn write_object_validation( defs: &BTreeMap, extra_it: &mut BTreeMap, ) -> std::io::Result<()> { - if obj_valid.properties.len() > 0 { + if !obj_valid.properties.is_empty() { writeln!(writer, "input {name} {{")?; writer.indent(); for (name, property) in obj_valid.properties { diff --git a/autogen/src/main.rs b/autogen/src/main.rs index c3834d4f3e..d26e5541aa 100644 --- a/autogen/src/main.rs +++ b/autogen/src/main.rs @@ -11,7 +11,7 @@ use serde_json::{json, Value}; use tailcall::cli::init_file; use tailcall::config; -static JSON_SCHEMA_FILE: &'static str = "../generated/.tailcallrc.schema.json"; +static JSON_SCHEMA_FILE: &str = "../generated/.tailcallrc.schema.json"; #[tokio::main] async fn main() { diff --git a/cloudflare/src/handle.rs b/cloudflare/src/handle.rs index 28e36dae38..1fe0357438 100644 --- a/cloudflare/src/handle.rs +++ b/cloudflare/src/handle.rs @@ -46,7 +46,7 @@ pub async fn fetch(req: worker::Request, env: worker::Env) -> anyhow::Result(hyper_req, app_ctx).await?; - Ok(to_response(resp).await?) + to_response(resp).await } /// diff --git a/cloudflare/src/lib.rs b/cloudflare/src/lib.rs index 17f670815f..80bb83af4b 100644 --- a/cloudflare/src/lib.rs +++ b/cloudflare/src/lib.rs @@ -17,6 +17,7 @@ pub fn init_env(env: Rc) -> Arc { } pub fn init_file(env: Rc, bucket_id: String) -> anyhow::Result> { + #[allow(clippy::arc_with_non_send_sync)] Ok(Arc::new(file::CloudflareFileIO::init(env, bucket_id)?)) } diff --git a/lint.sh b/lint.sh index 0105432b94..428e576588 100755 --- a/lint.sh +++ b/lint.sh @@ -6,16 +6,16 @@ FILE_TYPES="{graphql,yml,json,md,ts,js}" run_cargo_fmt() { MODE=$1 if [ "$MODE" == "check" ]; then - cargo +nightly fmt -- --check + cargo +nightly fmt --all -- --check else - cargo +nightly fmt + cargo +nightly fmt --all fi return $? } run_cargo_clippy() { MODE=$1 - CMD="cargo +nightly clippy --all-targets --all-features" + CMD="cargo +nightly clippy --all --all-targets --all-features" if [ "$MODE" == "fix" ]; then $CMD --fix --allow-staged --allow-dirty fi