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

Rust toolchain update #3396

Merged
merged 3 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions diesel/src/connection/statement_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl<'a, T> Deref for MaybeCached<'a, T> {
fn deref(&self) -> &Self::Target {
match *self {
MaybeCached::CannotCache(ref x) => x,
MaybeCached::Cached(ref x) => &**x,
MaybeCached::Cached(ref x) => x,
}
}
}
Expand All @@ -246,7 +246,7 @@ impl<'a, T> DerefMut for MaybeCached<'a, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
match *self {
MaybeCached::CannotCache(ref mut x) => x,
MaybeCached::Cached(ref mut x) => &mut **x,
MaybeCached::Cached(ref mut x) => x,
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions diesel/src/connection/transaction_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ where
Cow::from(format!("SAVEPOINT diesel_savepoint_{}", transaction_depth))
}
};
conn.batch_execute(&*start_transaction_sql)?;
conn.batch_execute(&start_transaction_sql)?;
Self::get_transaction_state(conn)?
.change_transaction_depth(TransactionDepthChange::IncreaseDepth)?;

Expand Down Expand Up @@ -362,7 +362,7 @@ where
None => return Err(Error::NotInTransaction),
};

match conn.batch_execute(&*rollback_sql) {
match conn.batch_execute(&rollback_sql) {
Ok(()) => {
Self::get_transaction_state(conn)?
.change_transaction_depth(TransactionDepthChange::DecreaseDepth)?;
Expand Down Expand Up @@ -410,7 +410,7 @@ where
transaction_depth.get() - 1
)),
};
match conn.batch_execute(&*commit_sql) {
match conn.batch_execute(&commit_sql) {
Ok(()) => {
Self::get_transaction_state(conn)?
.change_transaction_depth(TransactionDepthChange::DecreaseDepth)?;
Expand Down
28 changes: 7 additions & 21 deletions diesel/src/expression/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,28 +569,14 @@ pub mod is_aggregate {
}
}

// Note that these docs are similar to but slightly different than the stable
// docs below. Make sure if you change these that you also change the docs
// below.
/// Trait alias to represent an expression that isn't aggregate by default.
///
/// This alias represents a type which is not aggregate if there is no group by
/// clause. More specifically, it represents for types which implement
/// [`ValidGrouping<()>`] where `IsAggregate` is [`is_aggregate::No`] or
/// [`is_aggregate::Yes`].
///
/// While this trait is a useful stand-in for common cases, `T: NonAggregate`
/// cannot always be used when `T: ValidGrouping<(), IsAggregate = No>` or
/// `T: ValidGrouping<(), IsAggregate = Never>` could be. For that reason,
/// unless you need to abstract over both columns and literals, you should
/// prefer to use [`ValidGrouping<()>`] in your bounds instead.
///
/// [`ValidGrouping<()>`]: ValidGrouping
#[cfg(feature = "unstable")]
pub trait NonAggregate = ValidGrouping<()>
where
<Self as ValidGrouping<()>>::IsAggregate:
MixedAggregates<is_aggregate::No, Output = is_aggregate::No>;
// this needs to be a seperate module for the reasons given in
// https://github.com/rust-lang/rust/issues/65860
mod unstable;

#[cfg(feature = "unstable")]
#[doc(inline)]
pub use self::unstable::NonAggregate;

// Note that these docs are similar to but slightly different than the unstable
// docs above. Make sure if you change these that you also change the docs
Expand Down
13 changes: 7 additions & 6 deletions diesel/src/query_builder/ast_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,24 @@ where
/// done implicitly for references. For structs with lifetimes it must be
/// done explicitly. This method matches the semantics of what Rust would do
/// implicitly if you were passing a mutable reference
#[allow(clippy::explicit_auto_deref)] // clippy is wrong here
pub fn reborrow(&'_ mut self) -> AstPass<'_, 'b, DB> {
let internals = match self.internals {
AstPassInternals::ToSql(ref mut builder, ref mut options) => {
AstPassInternals::ToSql(&mut **builder, &mut **options)
AstPassInternals::ToSql(*builder, options)
}
AstPassInternals::CollectBinds {
ref mut collector,
ref mut metadata_lookup,
} => AstPassInternals::CollectBinds {
collector: &mut **collector,
metadata_lookup: &mut **metadata_lookup,
collector: *collector,
metadata_lookup: *metadata_lookup,
},
AstPassInternals::IsSafeToCachePrepared(ref mut result) => {
AstPassInternals::IsSafeToCachePrepared(&mut **result)
AstPassInternals::IsSafeToCachePrepared(result)
}
AstPassInternals::DebugBinds(ref mut f) => AstPassInternals::DebugBinds(&mut **f),
AstPassInternals::IsNoop(ref mut result) => AstPassInternals::IsNoop(&mut **result),
AstPassInternals::DebugBinds(ref mut f) => AstPassInternals::DebugBinds(f),
AstPassInternals::IsNoop(ref mut result) => AstPassInternals::IsNoop(result),
};
AstPass {
internals,
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl<'a, 'b, DB: Backend> Output<'a, 'b, DB> {
/// Returns the backend's mechanism for dynamically looking up type
/// metadata at runtime, if relevant for the given backend.
pub fn metadata_lookup(&mut self) -> &mut DB::MetadataLookup {
*self.metadata_lookup.as_mut().expect("Lookup is there")
self.metadata_lookup.as_mut().expect("Lookup is there")
}

/// Set the inner buffer to a specific value
Expand Down
2 changes: 1 addition & 1 deletion diesel_derives/tests/queryable_by_name.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(clippy::blacklisted_name)]
#![allow(clippy::disallowed_names)]
use diesel::sql_types::Integer;
use diesel::*;

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.64.0
1.65.0