Skip to content

Commit

Permalink
Merge pull request #3764 from weiznich/fix/new_warnings
Browse files Browse the repository at this point in the history
Fix a bunch of new warnings
  • Loading branch information
pksunkara authored Aug 25, 2023
2 parents 409585e + b816eda commit cf77884
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ jobs:
- name: Test diesel-derives (nightly)
if: matrix.rust == 'nightly'
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_derives/Cargo.toml --no-default-features --features "diesel/${{ matrix.backend }} diesel/unstable diesel/time time diesel/chrono chrono"
run: cargo +${{ matrix.rust }} test --manifest-path diesel_derives/Cargo.toml --no-default-features --features "diesel/${{ matrix.backend }} diesel/unstable diesel/time time diesel/chrono chrono ${{ matrix.backend }}"

- name: Test diesel-derives
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_derives/Cargo.toml --no-default-features --features "diesel/${{ matrix.backend }}"
run: cargo +${{ matrix.rust }} test --manifest-path diesel_derives/Cargo.toml --no-default-features --features "diesel/${{ matrix.backend }} ${{ matrix.backend }}"

- name: Test diesel-cli
shell: bash
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"diesel",
"diesel_cli",
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ where
/// If the transaction fails to commit due to a `SerializationFailure` or a
/// `ReadOnlyTransaction` a rollback will be attempted.
/// If the rollback fails, the error will be returned in a
/// [`Error::RollbackErrorOnCommit`](crate::result::Error::RollbackErrorOnCommit),
/// [`Error::RollbackErrorOnCommit`],
/// from which you will be able to extract both the original commit error and
/// the rollback error.
/// In addition, the connection will be considered broken
Expand Down
4 changes: 2 additions & 2 deletions diesel/src/connection/statement_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ where

/// Wraps a possibly cached prepared statement
///
/// Essentially a customized version of [`Cow`](std::borrow::Cow)
/// that does not depend on [`ToOwned`](std::borrow::ToOwned)
/// Essentially a customized version of [`Cow`]
/// that does not depend on [`ToOwned`]
#[allow(missing_debug_implementations, unreachable_pub)]
#[cfg_attr(
doc_cfg,
Expand Down
4 changes: 2 additions & 2 deletions diesel/src/connection/transaction_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ mod test {
.collect::<Vec<_>>();

results.sort_by_key(|r| r.is_err());
assert!(matches!(results[0], Ok(_)), "Got {:?} instead", results);
assert!(results[0].is_ok(), "Got {:?} instead", results);
// Note that contrary to Postgres, this is not a commit failure
assert!(
matches!(&results[1], Err(DatabaseError(SerializationFailure, _))),
Expand Down Expand Up @@ -982,7 +982,7 @@ mod test {
.collect::<Vec<_>>();

results.sort_by_key(|r| r.is_err());
assert!(matches!(results[0], Ok(_)), "Got {:?} instead", results);
assert!(results[0].is_ok(), "Got {:?} instead", results);
assert!(
matches!(&results[1], Err(DatabaseError(SerializationFailure, _))),
"Got {:?} instead",
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
//! `64-column-tables` feature. Enabling this feature will increase your compile times significantly.
//! - `i-implement-a-third-party-backend-and-opt-into-breaking-changes`: This feature opens up some otherwise
//! private API, that can be useful to implement a third party [`Backend`](crate::backend::Backend)
//! or write a custom [`Connection`](crate::connection::Connection) implementation. **Do not use this feature for
//! or write a custom [`Connection`] implementation. **Do not use this feature for
//! any other usecase**. By enabling this feature you explicitly opt out diesel stability guarantees. We explicitly
//! reserve us the right to break API's exported under this feature flag in any upcoming minor version release.
//! If you publish a crate depending on this feature flag consider to restrict the supported diesel version to the
Expand Down
4 changes: 2 additions & 2 deletions diesel/src/pg/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ mod tests {

results.sort_by_key(|r| r.is_err());

assert!(matches!(results[0], Ok(_)), "Got {:?} instead", results);
assert!(results[0].is_ok(), "Got {:?} instead", results);
assert!(
matches!(&results[1], Err(DatabaseError(SerializationFailure, _))),
"Got {:?} instead",
Expand Down Expand Up @@ -966,7 +966,7 @@ mod tests {

results.sort_by_key(|r| r.is_err());

assert!(matches!(results[0], Ok(_)), "Got {:?} instead", results);
assert!(results[0].is_ok(), "Got {:?} instead", results);
assert!(
matches!(&results[1], Err(DatabaseError(SerializationFailure, _))),
"Got {:?} instead",
Expand Down
4 changes: 2 additions & 2 deletions diesel/src/query_builder/query_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ mod tests {
}

#[test]
#[cfg(features = "postgres")]
#[cfg(feature = "postgres")]
fn boxed_queries_do_not_have_static_query_id() {
use pg::Pg;
use crate::pg::Pg;
assert!(query_id(users::table.into_boxed::<Pg>()).is_none());
}
}
3 changes: 1 addition & 2 deletions diesel/src/query_dsl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1268,13 +1268,12 @@ pub trait QueryDsl: Sized {
/// # }
/// ```
///
/// Diesel queries also have a similar problem to [`Iterator`][iterator], where
/// Diesel queries also have a similar problem to [`Iterator`], where
/// returning them from a function requires exposing the implementation of that
/// function. The [`helper_types`][helper_types] module exists to help with this,
/// but you might want to hide the return type or have it conditionally change.
/// Boxing can achieve both.
///
/// [iterator]: std::iter::Iterator
/// [helper_types]: crate::helper_types
///
/// ### Example
Expand Down
5 changes: 2 additions & 3 deletions diesel/src/sql_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,13 @@ pub type Decimal = Numeric;
///
/// ### [`ToSql`](crate::serialize::ToSql) impls
///
/// - [`String`][String]
/// - [`String`]
/// - [`&str`][str]
///
/// ### [`FromSql`](crate::deserialize::FromSql) impls
///
/// - [`String`][String]
/// - [`String`]
///
/// [String]: std::string::String
/// [str]: https://doc.rust-lang.org/nightly/std/primitive.str.html
#[derive(Debug, Clone, Copy, Default, QueryId, SqlType)]
#[diesel(postgres_type(oid = 25, array_oid = 1009))]
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/sqlite/connection/sqlite_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<'row, 'stmt, 'query> SqliteValue<'row, 'stmt, 'query> {
let s = unsafe {
let ptr = ffi::sqlite3_value_text(self.value.as_ptr());
let len = ffi::sqlite3_value_bytes(self.value.as_ptr());
let bytes = slice::from_raw_parts(ptr as *const u8, len as usize);
let bytes = slice::from_raw_parts(ptr, len as usize);
// The string is guaranteed to be utf8 according to
// https://www.sqlite.org/c3ref/value_blob.html
str::from_utf8_unchecked(bytes)
Expand Down

0 comments on commit cf77884

Please sign in to comment.