Skip to content

Commit

Permalink
chore: update Rust to 1.84.0 (#5130)
Browse files Browse the repository at this point in the history
  • Loading branch information
aqrln authored Jan 17, 2025
1 parent 2b21c24 commit ca32df3
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 37 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ members = [
"quaint",
]

[workspace.lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)', 'cfg(debug_assert)']

[workspace.dependencies]
async-trait = { version = "0.1.77" }
enumflags2 = { version = "0.7", features = ["serde"] }
Expand Down
3 changes: 2 additions & 1 deletion libs/crosstarget-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name = "crosstarget-utils"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lints]
workspace = true

[dependencies]
derive_more.workspace = true
Expand Down
8 changes: 8 additions & 0 deletions libs/driver-adapters/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ mysql = ["quaint/mysql"]
sqlite = ["quaint/sqlite"]
postgresql = ["quaint/postgresql"]

# napi-rs generated code has some cfg attributes that check for these features
# so we declare them here to silence the warnings. They should not be enabled.
noop = []
used_linker = []

[lints]
workspace = true

[dependencies]
async-trait.workspace = true
futures.workspace = true
Expand Down
3 changes: 3 additions & 0 deletions libs/query-engine-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "query-engine-common"
version = "0.1.0"
edition = "2021"

[lints]
workspace = true

[dependencies]
thiserror = "1"
url.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions prisma-fmt/src/references.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ fn find_where_used_in_relation_attribute<'a>(
attr.arguments
.arguments
.iter()
.find(|arg| arg.name().map_or(false, |name| name == "fields") && arg.value.is_array())
.find(|arg| arg.name() == Some("fields") && arg.value.is_array())
.and_then(|arg| {
arg.value.as_array().and_then(|arr| {
arr.0
.iter()
.find(|expr| expr.as_constant_value().map_or(false, |cv| cv.0 == name))
.find(|expr| expr.as_constant_value().is_some_and(|cv| cv.0 == name))
})
})
})
Expand All @@ -235,7 +235,7 @@ fn find_where_used_in_block_attribute<'ast>(
arg.value.as_array().and_then(|arr| {
arr.0
.iter()
.find(|expr| expr.as_constant_value().map_or(false, |cv| cv.0 == name))
.find(|expr| expr.as_constant_value().is_some_and(|cv| cv.0 == name))
})
})
.map(|arg| arg.span())
Expand Down
3 changes: 3 additions & 0 deletions prisma-schema-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ edition = "2021"
[lib]
crate-type = ["cdylib"]

[lints]
workspace = true

[dependencies]
wasm-bindgen.workspace = true
wasm-logger = { version = "0.2.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion quaint/src/connector/postgres/native/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<'a> TypedQuery<'a> {
}

#[async_trait]
impl<'a> PreparedQuery for TypedQuery<'a> {
impl PreparedQuery for TypedQuery<'_> {
fn param_types(&self) -> impl ExactSizeIterator<Item = &Type> {
self.metadata.param_types.iter()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use connector_interface::*;
use mongodb::{bson::Document, ClientSession, Database};
use query_structure::{prelude::*, AggregationSelection, Filter, QueryArguments};

pub async fn aggregate<'conn>(
pub async fn aggregate(
database: &Database,
session: &mut ClientSession,
model: &Model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use query_structure::*;
use std::future::IntoFuture;

/// Finds a single record. Joins are not required at the moment because the selector is always a unique one.
pub async fn get_single_record<'conn>(
pub async fn get_single_record(
database: &Database,
session: &mut ClientSession,
model: &Model,
Expand Down Expand Up @@ -44,7 +44,7 @@ pub async fn get_single_record<'conn>(
// - [x] Cursor
// - [x] Distinct select (inherently given from core).
// - [x] Relation aggregation count
pub async fn get_many_records<'conn>(
pub async fn get_many_records(
database: &Database,
session: &mut ClientSession,
model: &Model,
Expand Down Expand Up @@ -81,7 +81,7 @@ pub async fn get_many_records<'conn>(
Ok(records)
}

pub async fn get_related_m2m_record_ids<'conn>(
pub async fn get_related_m2m_record_ids(
database: &Database,
session: &mut ClientSession,
from_field: &RelationFieldRef,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use update::IntoUpdateDocumentExtension;

/// Create a single record to the database resulting in a
/// `RecordProjection` as an identifier pointing to the just-created document.
pub async fn create_record<'conn>(
pub async fn create_record(
database: &Database,
session: &mut ClientSession,
model: &Model,
Expand Down Expand Up @@ -69,7 +69,7 @@ pub async fn create_record<'conn>(
})
}

pub async fn create_records<'conn>(
pub async fn create_records(
database: &Database,
session: &mut ClientSession,
model: &Model,
Expand Down Expand Up @@ -140,7 +140,7 @@ pub async fn create_records<'conn>(
}
}

pub async fn update_records<'conn>(
pub async fn update_records(
database: &Database,
session: &mut ClientSession,
model: &Model,
Expand Down Expand Up @@ -228,7 +228,7 @@ pub async fn update_records<'conn>(
Ok(ids)
}

pub async fn delete_records<'conn>(
pub async fn delete_records(
database: &Database,
session: &mut ClientSession,
model: &Model,
Expand Down Expand Up @@ -267,7 +267,7 @@ pub async fn delete_records<'conn>(
Ok(delete_result.deleted_count as usize)
}

pub async fn delete_record<'conn>(
pub async fn delete_record(
database: &Database,
session: &mut ClientSession,
model: &Model,
Expand Down Expand Up @@ -347,7 +347,7 @@ async fn find_ids(

/// Connect relations defined in `child_ids` to a parent defined in `parent_id`.
/// The relation information is in the `RelationFieldRef`.
pub async fn m2m_connect<'conn>(
pub async fn m2m_connect(
database: &Database,
session: &mut ClientSession,
field: &RelationFieldRef,
Expand Down Expand Up @@ -419,7 +419,7 @@ pub async fn m2m_connect<'conn>(
Ok(())
}

pub async fn m2m_disconnect<'conn>(
pub async fn m2m_disconnect(
database: &Database,
session: &mut ClientSession,
field: &RelationFieldRef,
Expand Down Expand Up @@ -493,7 +493,7 @@ pub async fn m2m_disconnect<'conn>(
}

/// Execute raw is not implemented on MongoDB
pub async fn execute_raw<'conn>(
pub async fn execute_raw(
_database: &Database,
_session: &mut ClientSession,
_inputs: HashMap<String, PrismaValue>,
Expand All @@ -502,7 +502,7 @@ pub async fn execute_raw<'conn>(
}

/// Execute a plain MongoDB query, returning the answer as a JSON `Value`.
pub async fn query_raw<'conn>(
pub async fn query_raw(
database: &Database,
session: &mut ClientSession,
model: Option<&Model>,
Expand Down
8 changes: 8 additions & 0 deletions query-engine/query-engine-node-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ driver-adapters = [
"sql-connector/driver-adapters",
]

# napi-rs generated code has some cfg attributes that check for these features
# so we declare them here to silence the warnings. They should not be enabled.
noop = []
used_linker = []

[lints]
workspace = true

[dependencies]
anyhow = "1"
async-trait.workspace = true
Expand Down
3 changes: 3 additions & 0 deletions query-engine/query-engine-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ mysql = [
"request-handlers/mysql",
]

[lints]
workspace = true

[dependencies]

query-connector = { path = "../connectors/query-connector" }
Expand Down
2 changes: 1 addition & 1 deletion query-engine/request-handlers/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl<'a> RequestHandler<'a> {
small.iter().all(|(key, small_value)| {
large
.get(key)
.map_or(false, |large_value| Self::compare_values(small_value, large_value))
.is_some_and(|large_value| Self::compare_values(small_value, large_value))
})
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "1.83.0"
channel = "1.84.0"
components = ["clippy", "rustfmt", "rust-src"]
targets = [
# WASM target for serverless and edge environments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,8 @@ impl<'a> IndexFieldPair<'a> {
}

let ext: &PostgresSchemaExt = self.context.sql_schema.downcast_connector_data();

let next = match self.next {
Some(next) => next,
None => return None,
};

let opclass = match ext.get_opclass(next.id) {
Some(opclass) => opclass,
None => return None,
};
let next = self.next?;
let opclass = ext.get_opclass(next.id)?;

match &opclass.kind {
_ if opclass.is_default => None,
Expand Down Expand Up @@ -153,13 +145,8 @@ impl<'a> IndexFieldPair<'a> {
}

fn field(self) -> Option<ScalarFieldPair<'a>> {
let next = match self.next {
Some(next) => next,
None => return None,
};

let previous = self.context.existing_table_scalar_field(next.as_column().id);
let next = next.as_column();
let next = self.next?.as_column();
let previous = self.context.existing_table_scalar_field(next.id);

Some(IntrospectionPair::new(self.context, previous, next.coarsen()))
}
Expand Down

0 comments on commit ca32df3

Please sign in to comment.