diff --git a/psl/parser-database/src/attributes/default.rs b/psl/parser-database/src/attributes/default.rs index 74593353bd84..dcd22d316361 100644 --- a/psl/parser-database/src/attributes/default.rs +++ b/psl/parser-database/src/attributes/default.rs @@ -364,7 +364,7 @@ fn validate_dbgenerated_args(args: &[ast::Argument], accept: AcceptFn<'_>, ctx: bail() } - match args.get(0).map(|arg| &arg.value) { + match args.first().map(|arg| &arg.value) { Some(ast::Expression::StringValue(val, _)) if val.is_empty() => { ctx.push_attribute_validation_error( "dbgenerated() takes either no argument, or a single nonempty string argument.", @@ -382,7 +382,7 @@ fn validate_nanoid_args(args: &[ast::Argument], accept: AcceptFn<'_>, ctx: &mut bail() } - match args.get(0).map(|arg| &arg.value) { + match args.first().map(|arg| &arg.value) { Some(ast::Expression::NumericValue(val, _)) if val.parse::().unwrap() < 2 => { ctx.push_attribute_validation_error( "`nanoid()` takes either no argument, or a single integer argument >= 2.", diff --git a/quaint/src/connector/mssql/native/mod.rs b/quaint/src/connector/mssql/native/mod.rs index d22aa7a15dd6..124e14ac94d0 100644 --- a/quaint/src/connector/mssql/native/mod.rs +++ b/quaint/src/connector/mssql/native/mod.rs @@ -212,7 +212,7 @@ impl Queryable for Mssql { let rows = self.query_raw(query, &[]).await?; let version_string = rows - .get(0) + .first() .and_then(|row| row.get("version").and_then(|version| version.to_string())); Ok(version_string) diff --git a/quaint/src/connector/mysql/native/mod.rs b/quaint/src/connector/mysql/native/mod.rs index fdcc3a6276d1..98feb2649763 100644 --- a/quaint/src/connector/mysql/native/mod.rs +++ b/quaint/src/connector/mysql/native/mod.rs @@ -270,7 +270,7 @@ impl Queryable for Mysql { let rows = timeout::socket(self.socket_timeout, self.query_raw(query, &[])).await?; let version_string = rows - .get(0) + .first() .and_then(|row| row.get("version").and_then(|version| version.typed.to_string())); Ok(version_string) diff --git a/quaint/src/connector/postgres/native/mod.rs b/quaint/src/connector/postgres/native/mod.rs index 30f34e7002be..d656bceb1e00 100644 --- a/quaint/src/connector/postgres/native/mod.rs +++ b/quaint/src/connector/postgres/native/mod.rs @@ -491,7 +491,7 @@ impl Queryable for PostgreSql { let rows = self.query_raw(query, &[]).await?; let version_string = rows - .get(0) + .first() .and_then(|row| row.get("version").and_then(|version| version.to_string())); Ok(version_string) diff --git a/query-engine/connector-test-kit-rs/query-engine-tests/src/utils/mod.rs b/query-engine/connector-test-kit-rs/query-engine-tests/src/utils/mod.rs index 561e9c2ca121..75d712a27037 100644 --- a/query-engine/connector-test-kit-rs/query-engine-tests/src/utils/mod.rs +++ b/query-engine/connector-test-kit-rs/query-engine-tests/src/utils/mod.rs @@ -6,8 +6,6 @@ mod string; mod time; pub use bytes::*; -pub use json::*; -pub use querying::*; pub use raw::*; pub use string::*; pub use time::*; diff --git a/query-engine/connector-test-kit-rs/query-tests-setup/src/schema_gen/query_params.rs b/query-engine/connector-test-kit-rs/query-tests-setup/src/schema_gen/query_params.rs index f893f222bc9e..96851d2dab17 100644 --- a/query-engine/connector-test-kit-rs/query-tests-setup/src/schema_gen/query_params.rs +++ b/query-engine/connector-test-kit-rs/query-tests-setup/src/schema_gen/query_params.rs @@ -60,7 +60,7 @@ impl QueryParams { pub fn parse_many_first(&self, json: serde_json::Value, path: &[&str]) -> Result { let val = self.where_many.parse(&json, path)?; - Ok(val.get(0).unwrap().to_owned()) + Ok(val.first().unwrap().to_owned()) } /// Parses the JSON _array_ result of a mutation sent to the Query Engine in order to extract the generated id(s). diff --git a/query-engine/connectors/mongodb-query-connector/src/orderby.rs b/query-engine/connectors/mongodb-query-connector/src/orderby.rs index 15b37691ed27..76e589ae77c5 100644 --- a/query-engine/connectors/mongodb-query-connector/src/orderby.rs +++ b/query-engine/connectors/mongodb-query-connector/src/orderby.rs @@ -188,7 +188,7 @@ impl OrderByPrefix { } pub(crate) fn first(&self) -> Option<&String> { - self.parts.get(0) + self.parts.first() } } diff --git a/query-engine/connectors/mongodb-query-connector/src/root_queries/write.rs b/query-engine/connectors/mongodb-query-connector/src/root_queries/write.rs index a821eddc3c69..0330f4a9673b 100644 --- a/query-engine/connectors/mongodb-query-connector/src/root_queries/write.rs +++ b/query-engine/connectors/mongodb-query-connector/src/root_queries/write.rs @@ -338,7 +338,7 @@ pub async fn m2m_connect<'conn>( let child_ids = child_ids .iter() .map(|child_id| { - let (selection, value) = child_id.pairs.get(0).unwrap(); + let (selection, value) = child_id.pairs.first().unwrap(); (selection, value.clone()) .into_bson() @@ -404,7 +404,7 @@ pub async fn m2m_disconnect<'conn>( let child_ids = child_ids .iter() .map(|child_id| { - let (field, value) = child_id.pairs.get(0).unwrap(); + let (field, value) = child_id.pairs.first().unwrap(); (field, value.clone()) .into_bson() diff --git a/query-engine/connectors/sql-query-connector/src/cursor_condition.rs b/query-engine/connectors/sql-query-connector/src/cursor_condition.rs index d34fd49b2a3d..1f91eff8a299 100644 --- a/query-engine/connectors/sql-query-connector/src/cursor_condition.rs +++ b/query-engine/connectors/sql-query-connector/src/cursor_condition.rs @@ -577,7 +577,7 @@ fn take_last_two_elem(slice: &[T]) -> (Option<&T>, Option<&T>) { match len { 0 => (None, None), - 1 => (None, slice.get(0)), + 1 => (None, slice.first()), _ => (slice.get(len - 2), slice.get(len - 1)), } } diff --git a/query-engine/core/src/executor/execute_operation.rs b/query-engine/core/src/executor/execute_operation.rs index dabe071cd688..6ef445d8364e 100644 --- a/query-engine/core/src/executor/execute_operation.rs +++ b/query-engine/core/src/executor/execute_operation.rs @@ -1,4 +1,4 @@ -#![cfg_attr(target_arch = "wasm32", allow(unused_variables))] +#![allow(unused_variables)] #![cfg_attr(not(feature = "metrics"), allow(clippy::let_and_return))] use super::pipeline::QueryPipeline; diff --git a/query-engine/driver-adapters/src/conversion/js_to_quaint.rs b/query-engine/driver-adapters/src/conversion/js_to_quaint.rs index 3f5a65395896..d57b2f5bd7b9 100644 --- a/query-engine/driver-adapters/src/conversion/js_to_quaint.rs +++ b/query-engine/driver-adapters/src/conversion/js_to_quaint.rs @@ -1,7 +1,7 @@ use std::borrow::Cow; use std::str::FromStr; -pub use crate::types::{ColumnType, JSResultSet, Query, TransactionOptions}; +pub use crate::types::{ColumnType, JSResultSet}; use quaint::bigdecimal::{BigDecimal, FromPrimitive}; use quaint::chrono::{DateTime, NaiveDate, NaiveTime, Utc}; use quaint::{ diff --git a/query-engine/driver-adapters/src/conversion/mod.rs b/query-engine/driver-adapters/src/conversion/mod.rs index 3ef41fed903e..34ad8d3ae66c 100644 --- a/query-engine/driver-adapters/src/conversion/mod.rs +++ b/query-engine/driver-adapters/src/conversion/mod.rs @@ -6,4 +6,3 @@ pub(crate) mod postgres; pub(crate) mod sqlite; pub use js_arg::JSArg; -pub use js_to_quaint::*; diff --git a/query-engine/driver-adapters/src/proxy.rs b/query-engine/driver-adapters/src/proxy.rs index ae10534787f9..8e1d39138cb6 100644 --- a/query-engine/driver-adapters/src/proxy.rs +++ b/query-engine/driver-adapters/src/proxy.rs @@ -1,6 +1,6 @@ use crate::send_future::UnsafeFuture; use crate::types::JsConnectionInfo; -pub use crate::types::{ColumnType, JSResultSet, Query, TransactionOptions}; +pub use crate::types::{JSResultSet, Query, TransactionOptions}; use crate::{ from_js_value, get_named_property, get_optional_named_property, to_rust_str, AdapterMethod, JsObject, JsResult, JsString, JsTransaction, diff --git a/query-engine/query-engine-wasm/src/lib.rs b/query-engine/query-engine-wasm/src/lib.rs index bc22931513e8..bdbd79f52776 100644 --- a/query-engine/query-engine-wasm/src/lib.rs +++ b/query-engine/query-engine-wasm/src/lib.rs @@ -19,4 +19,5 @@ mod arch { pub(crate) type Result = std::result::Result; } +#[cfg_attr(not(target_arch = "wasm32"), allow(unused_imports))] pub use arch::*; diff --git a/query-engine/query-structure/src/default_value.rs b/query-engine/query-structure/src/default_value.rs index bcbdc739bf0e..9eaf6828d1c8 100644 --- a/query-engine/query-structure/src/default_value.rs +++ b/query-engine/query-structure/src/default_value.rs @@ -59,7 +59,9 @@ impl DefaultKind { // intended for primary key values! pub fn to_dbgenerated_func(&self) -> Option { match self { - DefaultKind::Expression(ref expr) if expr.is_dbgenerated() => expr.args.get(0).map(|val| val.1.to_string()), + DefaultKind::Expression(ref expr) if expr.is_dbgenerated() => { + expr.args.first().map(|val| val.1.to_string()) + } _ => None, } } @@ -217,7 +219,7 @@ impl ValueGenerator { return None; } - self.args.get(0).and_then(|v| v.1.as_string()) + self.args.first().and_then(|v| v.1.as_string()) } #[cfg(feature = "default_generators")] diff --git a/query-engine/query-structure/src/field/scalar.rs b/query-engine/query-structure/src/field/scalar.rs index 52d59686fdda..2e6474947227 100644 --- a/query-engine/query-structure/src/field/scalar.rs +++ b/query-engine/query-structure/src/field/scalar.rs @@ -207,7 +207,7 @@ pub fn dml_default_kind(default_value: &ast::Expression, scalar_type: Option { DefaultKind::Expression(ValueGenerator::new_dbgenerated( args.arguments - .get(0) + .first() .and_then(|arg| arg.value.as_string_value()) .map(|(val, _)| val.to_owned()) .unwrap_or_else(String::new), @@ -231,7 +231,7 @@ pub fn dml_default_kind(default_value: &ast::Expression, scalar_type: Option { DefaultKind::Expression(ValueGenerator::new_nanoid( args.arguments - .get(0) + .first() .and_then(|arg| arg.value.as_numeric_value()) .map(|(val, _)| val.parse::().unwrap()), )) diff --git a/query-engine/query-structure/src/filter/scalar/mod.rs b/query-engine/query-structure/src/filter/scalar/mod.rs index adc2cc6de320..a0c5a2d310fe 100644 --- a/query-engine/query-structure/src/filter/scalar/mod.rs +++ b/query-engine/query-structure/src/filter/scalar/mod.rs @@ -2,7 +2,6 @@ mod compare; mod condition; mod projection; -pub use compare::*; pub use condition::*; pub use projection::*; diff --git a/schema-engine/connectors/sql-schema-connector/src/flavour/postgres.rs b/schema-engine/connectors/sql-schema-connector/src/flavour/postgres.rs index 4942f0f4eff5..83c641797872 100644 --- a/schema-engine/connectors/sql-schema-connector/src/flavour/postgres.rs +++ b/schema-engine/connectors/sql-schema-connector/src/flavour/postgres.rs @@ -592,7 +592,7 @@ where let version = schema_exists_result - .get(0) + .first() .and_then(|row| row.at(1).and_then(|ver_str| row.at(2).map(|ver_num| (ver_str, ver_num)))) .and_then(|(ver_str,ver_num)| ver_str.to_string().and_then(|version| ver_num.as_integer().map(|version_number| (version, version_number)))); @@ -625,7 +625,7 @@ where } if let Some(true) = schema_exists_result - .get(0) + .first() .and_then(|row| row.at(0).and_then(|value| value.as_bool())) { return Ok((circumstances, connection)) diff --git a/schema-engine/connectors/sql-schema-connector/src/introspection/introspection_pair/default.rs b/schema-engine/connectors/sql-schema-connector/src/introspection/introspection_pair/default.rs index 0c5f6f1f0a45..dcb04371439b 100644 --- a/schema-engine/connectors/sql-schema-connector/src/introspection/introspection_pair/default.rs +++ b/schema-engine/connectors/sql-schema-connector/src/introspection/introspection_pair/default.rs @@ -121,7 +121,7 @@ impl<'a> DefaultValuePair<'a> { Some(previous) if previous.is_nanoid() => { let length = previous.value().as_function().and_then(|(_, args, _)| { args.arguments - .get(0) + .first() .map(|arg| arg.value.as_numeric_value().unwrap().0.parse::().unwrap()) }); diff --git a/schema-engine/connectors/sql-schema-connector/src/sql_schema_calculator.rs b/schema-engine/connectors/sql-schema-connector/src/sql_schema_calculator.rs index 10a87b96d5a5..3516d0136045 100644 --- a/schema-engine/connectors/sql-schema-connector/src/sql_schema_calculator.rs +++ b/schema-engine/connectors/sql-schema-connector/src/sql_schema_calculator.rs @@ -27,7 +27,7 @@ pub(crate) fn calculate_sql_schema(datamodel: &ValidatedSchema, flavour: &dyn Sq schemas: Default::default(), }; - if let Some(ds) = context.datamodel.configuration.datasources.get(0) { + if let Some(ds) = context.datamodel.configuration.datasources.first() { for (schema, _) in &ds.namespaces { context .schemas @@ -608,6 +608,6 @@ fn unwrap_dbgenerated(expr: &ast::Expression) -> Option { .unwrap() .1 .arguments - .get(0) + .first() .map(|arg| arg.value.as_string_value().unwrap().0.to_owned()) } diff --git a/schema-engine/sql-schema-describer/src/postgres/default/tokenize.rs b/schema-engine/sql-schema-describer/src/postgres/default/tokenize.rs index 23c9eb3dbfd1..0761c63b88de 100644 --- a/schema-engine/sql-schema-describer/src/postgres/default/tokenize.rs +++ b/schema-engine/sql-schema-describer/src/postgres/default/tokenize.rs @@ -18,7 +18,7 @@ pub(super) enum Token { Identifier, UnterminatedStringLiteral, Whitespace, - BadToken, + Unknown, } pub(super) fn tokenize(default_string: &str) -> Vec<(Token, u32)> { @@ -43,7 +43,7 @@ pub(super) fn tokenize(default_string: &str) -> Vec<(Token, u32)> { out.push((Token::CastOperator, start)) } None | Some(_) => { - out.push((Token::BadToken, start)); + out.push((Token::Unknown, start)); return out; } }, @@ -164,7 +164,7 @@ pub(super) fn tokenize(default_string: &str) -> Vec<(Token, u32)> { } } }, - Some((start, _)) => out.push((Token::BadToken, start)), + Some((start, _)) => out.push((Token::Unknown, start)), } } }