Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Fix few build warnings, and make CI fail on warn #2651

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
--release
--no-default-features
--features mysql,postgres,sqlite
env:
RUSTFLAGS: -D warnings

- uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -157,10 +159,9 @@ jobs:
# so we only check that it compiles.
- name: Chat (Check)
uses: actions-rs/cargo@v1
env:
with:
command: check
args: -p sqlx-example-postgres-check
args: -p sqlx-example-postgres-chat

- name: Files (Setup)
working-directory: examples/postgres/files
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/sqlx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,17 @@ jobs:
--manifest-path sqlx-core/Cargo.toml
--no-default-features
--features json,offline,migrate,_rt-${{ matrix.runtime }},_tls-${{ matrix.tls }}
env:
RUSTFLAGS: -D warnings

- uses: actions-rs/cargo@v1
with:
command: check
args: >
--no-default-features
--features all-databases,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }},macros
env:
RUSTFLAGS: -D warnings

test:
name: Unit Test
Expand Down Expand Up @@ -189,7 +193,7 @@ jobs:
env:
SQLX_OFFLINE: true
SQLX_OFFLINE_DIR: .sqlx
RUSTFLAGS: --cfg sqlite_ipaddr
RUSTFLAGS: -D warnings --cfg sqlite_ipaddr
LD_LIBRARY_PATH: /tmp/sqlite3-lib

# Test macros in offline mode (still needs DATABASE_URL to run)
Expand Down Expand Up @@ -233,7 +237,7 @@ jobs:
env:
# FIXME: needed to disable `ltree` tests in Postgres 9.6
# but `PgLTree` should just fall back to text format
RUSTFLAGS: --cfg postgres_${{ matrix.postgres }}
RUSTFLAGS: -D warnings --cfg postgres_${{ matrix.postgres }}
with:
command: build
args: >
Expand Down Expand Up @@ -289,7 +293,7 @@ jobs:
SQLX_OFFLINE_DIR: .sqlx
# FIXME: needed to disable `ltree` tests in Postgres 9.6
# but `PgLTree` should just fall back to text format
RUSTFLAGS: --cfg postgres_${{ matrix.postgres }}
RUSTFLAGS: -D warnings --cfg postgres_${{ matrix.postgres }}

# Test macros in offline mode (still needs DATABASE_URL to run)
- uses: actions-rs/cargo@v1
Expand Down Expand Up @@ -399,7 +403,7 @@ jobs:
env:
SQLX_OFFLINE: true
SQLX_OFFLINE_DIR: .sqlx
RUSTFLAGS: --cfg mysql_${{ matrix.mysql }}
RUSTFLAGS: -D warnings --cfg mysql_${{ matrix.mysql }}

# Test macros in offline mode (still needs DATABASE_URL to run)
# MySQL 5.7 supports TLS but not TLSv1.3 as required by RusTLS.
Expand Down Expand Up @@ -495,7 +499,7 @@ jobs:
env:
SQLX_OFFLINE: true
SQLX_OFFLINE_DIR: .sqlx
RUSTFLAGS: --cfg mariadb_${{ matrix.mariadb }}
RUSTFLAGS: -D warnings --cfg mariadb_${{ matrix.mariadb }}

# Test macros in offline mode (still needs DATABASE_URL to run)
- uses: actions-rs/cargo@v1
Expand Down
2 changes: 2 additions & 0 deletions sqlx-macros-core/src/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ pub trait DatabaseExt: Database {
fn describe_blocking(query: &str, database_url: &str) -> sqlx_core::Result<Describe<Self>>;
}

#[allow(dead_code)]
pub struct CachingDescribeBlocking<DB: DatabaseExt> {
connections: Lazy<Mutex<HashMap<String, DB::Connection>>>,
}

#[allow(dead_code)]
impl<DB: DatabaseExt> CachingDescribeBlocking<DB> {
pub const fn new() -> Self {
CachingDescribeBlocking {
Expand Down
12 changes: 7 additions & 5 deletions sqlx-macros-core/src/test_attr.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
use proc_macro2::{Span, TokenStream};
use proc_macro2::TokenStream;
use quote::quote;
use syn::LitStr;

#[cfg(feature = "migrate")]
struct Args {
fixtures: Vec<LitStr>,
fixtures: Vec<syn::LitStr>,
migrations: MigrationsOpt,
}

#[cfg(feature = "migrate")]
enum MigrationsOpt {
InferredPath,
ExplicitPath(LitStr),
ExplicitPath(syn::LitStr),
ExplicitMigrator(syn::Path),
Disabled,
}
Expand Down Expand Up @@ -89,7 +90,8 @@ fn expand_advanced(args: syn::AttributeArgs, input: syn::ItemFn) -> crate::Resul
quote! { args.migrator(&#migrator); }
}
MigrationsOpt::InferredPath if !inputs.is_empty() => {
let migrations_path = crate::common::resolve_path("./migrations", Span::call_site())?;
let migrations_path =
crate::common::resolve_path("./migrations", proc_macro2::Span::call_site())?;

if migrations_path.is_dir() {
let migrator = crate::migrate::expand_migrator(&migrations_path)?;
Expand Down
2 changes: 1 addition & 1 deletion sqlx-sqlite/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ impl LockedSqliteHandle<'_> {
/// The progress handler callback must not do anything that will modify the database connection that invoked
/// the progress handler. Note that sqlite3_prepare_v2() and sqlite3_step() both modify their database connections
/// in this context.
pub fn set_progress_handler<F>(&mut self, num_ops: i32, mut callback: F)
pub fn set_progress_handler<F>(&mut self, num_ops: i32, callback: F)
where
F: FnMut() -> bool + Send + 'static,
{
Expand Down
Loading