Skip to content

Commit

Permalink
chore: update Rust to 1.80.1 (prisma#4972)
Browse files Browse the repository at this point in the history
* Update nix flake

* Update Rust to 1.80

* Fix clippy::derive_ord_xor_partial_ord

* Fix clippy::needless_borrows_for_generic_args

* Update time dependency to fix compilation error

* Fix auto-fixable clippy issues

* Fix clippy::doc_lazy_continuation

* Remove `cfg` for non-existent `bigdecimal` feature and thus enable test

Remove `cfg` attribute for non-existent `bigdecimal` feature in quaint test.
Besides fixing a compiler warning, this also enables this test, which
was previously skipped.

* Fix clippy::legacy_numeric_constants

* Remove dead code in introspection test API

* Suppress dead code warning in MigrationRecord

* Update flake for Rust 1.80.1

* Update Rust to 1.80.1

* Revert "Suppress dead code warning in MigrationRecord"

This reverts commit 4ccdd05.

* Revert "Remove dead code in introspection test API"

This reverts commit 48e90a1.

* Reapply "Suppress dead code warning in MigrationRecord"

This reverts commit 0ec17d3.

* Reapply "Remove dead code in introspection test API"

This reverts commit 7577f28.

* Fix clippy::doc_lazy_continuation in interactive_transactions/mod.rs
  • Loading branch information
aqrln authored Aug 12, 2024
1 parent 98ab935 commit d33dcc5
Show file tree
Hide file tree
Showing 33 changed files with 126 additions and 141 deletions.
42 changes: 30 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 12 additions & 36 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
Expand All @@ -19,7 +15,6 @@
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
nixpkgs.url = "nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
Expand Down
2 changes: 1 addition & 1 deletion libs/prisma-value/src/raw_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use serde_json::value::RawValue;
/// directly because:
/// 1. We need `Eq` implementation
/// 2. `serde_json::value::RawValue::from_string` may error and we'd like to delay handling of that error to
/// serialization time
/// serialization time
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RawJson {
value: String,
Expand Down
5 changes: 3 additions & 2 deletions prisma-fmt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,15 @@ pub fn hover(schema_files: String, params: &str) -> String {

/// The two parameters are:
/// - The [`SchemaFileInput`] to reformat, as a string.
/// - An LSP
/// [DocumentFormattingParams](https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-16.md#textDocument_formatting) object, as JSON.
/// - An LSP [`DocumentFormattingParams`][1] object, as JSON.
///
/// The function returns the formatted schema, as a string.
/// If the schema or any of the provided parameters is invalid, the function returns the original schema.
/// This function never panics.
///
/// Of the DocumentFormattingParams, we only take into account tabSize, at the moment.
///
/// [1]: https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-16.md#textDocument_formatting
pub fn format(datamodel: String, params: &str) -> String {
let schema: SchemaFileInput = match serde_json::from_str(&datamodel) {
Ok(params) => params,
Expand Down
5 changes: 1 addition & 4 deletions prisma-fmt/tests/code_actions/test_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ pub(crate) fn test_scenario(scenario_name: &str) {
.as_str()
};

let diagnostics = match parse_schema_diagnostics(&schema_files, initiating_file_name) {
Some(diagnostics) => diagnostics,
None => Vec::new(),
};
let diagnostics = parse_schema_diagnostics(&schema_files, initiating_file_name).unwrap_or_default();

path.clear();
write!(path, "{SCENARIOS_PATH}/{scenario_name}/result.json").unwrap();
Expand Down
8 changes: 7 additions & 1 deletion psl/parser-database/src/walkers/relation_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl<'db> RelationFieldWalker<'db> {
}

/// The relation name.
#[derive(Debug, Clone, PartialOrd)]
#[derive(Debug, Clone)]
pub enum RelationName<'db> {
/// A relation name specified in the AST.
Explicit(&'db str),
Expand Down Expand Up @@ -201,6 +201,12 @@ impl<'db> Ord for RelationName<'db> {
}
}

impl<'db> PartialOrd for RelationName<'db> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}

impl<'db> std::hash::Hash for RelationName<'db> {
fn hash<H: Hasher>(&self, state: &mut H) {
match self {
Expand Down
2 changes: 1 addition & 1 deletion psl/psl-core/src/mcf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub use source::*;
use serde::Serialize;

pub fn config_to_mcf_json_value(mcf: &crate::Configuration, files: &Files) -> serde_json::Value {
serde_json::to_value(&model_to_serializable(mcf, files)).expect("Failed to render JSON.")
serde_json::to_value(model_to_serializable(mcf, files)).expect("Failed to render JSON.")
}

#[derive(Debug, Serialize)]
Expand Down
2 changes: 1 addition & 1 deletion quaint/src/pooled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ impl Builder {
/// pool.
///
/// - Defaults to `false`, meaning connections are never tested on
/// `check_out`.
/// `check_out`.
///
/// [`check_out`]: struct.Quaint.html#method.check_out
pub fn test_on_check_out(&mut self, test_on_check_out: bool) {
Expand Down
8 changes: 3 additions & 5 deletions quaint/src/tests/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ async fn returning_update(api: &mut dyn TestApi) -> crate::Result<()> {
Ok(())
}

#[cfg(all(feature = "mssql", feature = "bigdecimal"))]
#[cfg(feature = "mssql")]
#[test_each_connector(tags("mssql"))]
async fn returning_decimal_insert_with_type_defs(api: &mut dyn TestApi) -> crate::Result<()> {
use bigdecimal::BigDecimal;
Expand Down Expand Up @@ -1388,15 +1388,13 @@ async fn unsigned_integers_are_handled(api: &mut dyn TestApi) -> crate::Result<(
.create_temp_table("id int4 auto_increment primary key, big bigint unsigned")
.await?;

let insert = Insert::multi_into(&table, ["big"])
.values((2,))
.values((std::i64::MAX,));
let insert = Insert::multi_into(&table, ["big"]).values((2,)).values((i64::MAX,));
api.conn().insert(insert.into()).await?;

let select = Select::from_table(&table).column("big").order_by("id");
let roundtripped = api.conn().select(select).await?;

let expected = &[2, std::i64::MAX];
let expected = &[2, i64::MAX];
let actual: Vec<i64> = roundtripped
.into_iter()
.map(|row| row.at(0).unwrap().as_i64().unwrap())
Expand Down
2 changes: 1 addition & 1 deletion quaint/src/tests/query/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ async fn int_unsigned_negative_value_out_of_range(api: &mut dyn TestApi) -> crat

// Value too big
{
let insert = Insert::multi_into(&table, ["big"]).values((std::i64::MAX,));
let insert = Insert::multi_into(&table, ["big"]).values((i64::MAX,));
let result = api.conn().insert(insert.into()).await;

assert!(matches!(result.unwrap_err().kind(), ErrorKind::ValueOutOfRange { .. }));
Expand Down
5 changes: 1 addition & 4 deletions query-engine/black-box-tests/tests/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ pub(crate) fn query_engine_cmd(dml: &str) -> (process::Command, String) {
cmd.env_clear();

let port = generate_free_port();
cmd.env("PRISMA_DML", dml)
.arg("--port")
.arg(&port.to_string())
.arg("-g");
cmd.env("PRISMA_DML", dml).arg("--port").arg(port.to_string()).arg("-g");

(cmd, format!("http://0.0.0.0:{}", port))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::{Context, QueryExt, Queryable};
use connector_interface::*;
use itertools::Itertools;
use query_structure::*;
use std::usize;

/// Performs an update with an explicit selection set.
/// This function is called for connectors that supports the `UpdateReturning` capability.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use std::borrow::Cow;
use std::{
collections::{HashMap, HashSet},
ops::Deref,
usize,
};
use user_facing_errors::query_engine::DatabaseConstraint;

Expand Down
6 changes: 3 additions & 3 deletions query-engine/core/src/interactive_transactions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub(crate) use messages::*;
/// process and waits for messages to arrive via its receive channel to process.
/// The Transaction Actor Manager will also create an ITXClient and add it to hashmap managed by an RwLock. The ITXClient is the only way to communicate
/// with the ITXServer.
///
/// Once Prisma Client receives the iTx Id it can perform database operations using that iTx id. When an operation request is received by the
/// TransactionActorManager, it looks for the client in the hashmap and passes the operation to the client. The ITXClient sends a message to the
/// ITXServer and waits for a response. The ITXServer will then perform the operation and return the result. The ITXServer will perform one
Expand All @@ -31,10 +31,10 @@ pub(crate) use messages::*;
/// The ITXServer will handle all messages until:
/// - It transitions state, e.g "rollback" or "commit"
/// - It exceeds its timeout, in which case the iTx is rolledback and the connection to the database is closed.
///
/// Once the ITXServer is done handling messages from the iTx Client, it sends a last message to the Background Client list Actor to say that it is completed and then shuts down.
/// The Background Client list Actor removes the client from the list of active clients and keeps in cache the iTx id of the closed transaction.
///
/// We keep a list of closed transactions so that if any further messages are received for this iTx id,
/// the TransactionActorManager can reply with a helpful error message which explains that no operation can be performed on a closed transaction
/// rather than an error message stating that the transaction does not exist.
Expand Down
1 change: 1 addition & 0 deletions query-engine/core/src/query_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ impl QueryGraph {
/// - ... not an `if`-flow node themself
/// - ... not already connected to the current `if`-flow node in any form (to prevent double edges)
/// - ... not connected to another `if`-flow node with control flow edges (indirect sibling)
///
/// will be ordered below the currently processed `if`-flow node in execution predence.
///
/// ```text
Expand Down
Loading

0 comments on commit d33dcc5

Please sign in to comment.