From fcdc37227eb722a03058a78c09f593557102b9a3 Mon Sep 17 00:00:00 2001 From: Raphael Darley Date: Mon, 9 Sep 2024 16:22:55 +0100 Subject: [PATCH] Fix formatting and import for nightly (#4716) --- .github/workflows/ci.yml | 33 +++++++++++++++++++++++++++++++-- Makefile.ci.toml | 5 +++++ core/src/gql/ext.rs | 9 +++++---- core/src/gql/schema.rs | 1 + 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 030fe5d6..2f4b14f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,8 +52,6 @@ jobs: steps: - name: Install stable toolchain uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - name: Checkout sources uses: actions/checkout@v4 @@ -73,6 +71,37 @@ jobs: - name: Check workspace run: cargo make ci-check + - name: Check workspace release + run: cargo make ci-check-release + + check-msrv: + name: Check workspace MSRV + runs-on: ubuntu-latest + steps: + - name: Install MSRV toolchain + uses: dtolnay/rust-toolchain@1.80.1 + + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Setup cache + uses: Swatinem/rust-cache@v2 + with: + save-if: ${{ github.ref == 'refs/heads/main' }} + + - name: Install dependencies + run: | + sudo apt-get -y update + + - name: Install cargo-make + run: cargo install --debug --locked cargo-make + + - name: Check workspace on MSRV + run: cargo make ci-check + + - name: Check workspace release on MSRV + run: cargo make ci-check-release + check-fuzzing: name: Check fuzzing runs-on: ubuntu-latest diff --git a/Makefile.ci.toml b/Makefile.ci.toml index b741e19e..dc432eed 100644 --- a/Makefile.ci.toml +++ b/Makefile.ci.toml @@ -7,6 +7,11 @@ category = "CI - CHECK" command = "cargo" args = ["check", "--locked", "--workspace"] +[tasks.ci-check-release] +category = "CI - CHECK" +command = "cargo" +args = ["check", "--release", "--locked", "--workspace"] + [tasks.ci-check-wasm] category = "CI - CHECK" command = "cargo" diff --git a/core/src/gql/ext.rs b/core/src/gql/ext.rs index 712ced85..173a4b96 100644 --- a/core/src/gql/ext.rs +++ b/core/src/gql/ext.rs @@ -1,9 +1,6 @@ -use std::mem; - use crate::sql::{ statements::UseStatement, Cond, Ident, Idiom, Limit, Order, Orders, Part, Start, Table, Value, }; -use async_graphql::dynamic::Scalar; pub trait IntoExt { fn intox(self) -> T; @@ -121,6 +118,7 @@ where } } +#[cfg(debug_assertions)] pub trait ValidatorExt { fn add_validator( &mut self, @@ -128,13 +126,16 @@ pub trait ValidatorExt { ) -> &mut Self; } +#[cfg(debug_assertions)] +use async_graphql::dynamic::Scalar; +#[cfg(debug_assertions)] impl ValidatorExt for Scalar { fn add_validator( &mut self, validator: impl Fn(&async_graphql::Value) -> bool + Send + Sync + 'static, ) -> &mut Self { let mut tmp = Scalar::new(""); - mem::swap(self, &mut tmp); + std::mem::swap(self, &mut tmp); *self = tmp.validator(validator); self } diff --git a/core/src/gql/schema.rs b/core/src/gql/schema.rs index 6b156cdb..32979894 100644 --- a/core/src/gql/schema.rs +++ b/core/src/gql/schema.rs @@ -26,6 +26,7 @@ use serde_json::Number; use super::error::{resolver_error, GqlError}; use super::ext::IntoExt; +#[cfg(debug_assertions)] use super::ext::ValidatorExt; use crate::gql::error::{internal_error, schema_error, type_error}; use crate::gql::ext::TryAsExt;