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

Remove Self: Type bounds in Encode / Decode implementations #1170

Merged
merged 2 commits into from
Apr 16, 2021
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
8 changes: 6 additions & 2 deletions sqlx-core/src/net/tls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ where
#[cfg(all(not(feature = "_rt-async-std"), feature = "_tls-native-tls"))]
MaybeTlsStream::Tls(s) => s.get_ref().get_ref().get_ref(),

MaybeTlsStream::Upgrading => panic!(io::Error::from(io::ErrorKind::ConnectionAborted)),
MaybeTlsStream::Upgrading => {
panic!("{}", io::Error::from(io::ErrorKind::ConnectionAborted))
}
}
}
}
Expand All @@ -252,7 +254,9 @@ where
#[cfg(all(not(feature = "_rt-async-std"), feature = "_tls-native-tls"))]
MaybeTlsStream::Tls(s) => s.get_mut().get_mut().get_mut(),

MaybeTlsStream::Upgrading => panic!(io::Error::from(io::ErrorKind::ConnectionAborted)),
MaybeTlsStream::Upgrading => {
panic!("{}", io::Error::from(io::ErrorKind::ConnectionAborted))
}
}
}
}
3 changes: 0 additions & 3 deletions sqlx-core/src/postgres/types/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ impl<'q, T> Encode<'q, Postgres> for Vec<T>
where
for<'a> &'a [T]: Encode<'q, Postgres>,
T: Encode<'q, Postgres>,
Self: Type<Postgres>,
{
#[inline]
fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull {
Expand All @@ -48,7 +47,6 @@ where
impl<'q, T> Encode<'q, Postgres> for &'_ [T]
where
T: Encode<'q, Postgres> + Type<Postgres>,
Self: Type<Postgres>,
{
fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull {
buf.extend(&1_i32.to_be_bytes()); // number of dimensions
Expand Down Expand Up @@ -77,7 +75,6 @@ where
impl<'r, T> Decode<'r, Postgres> for Vec<T>
where
T: for<'a> Decode<'a, Postgres> + Type<Postgres>,
Self: Type<Postgres>,
{
fn decode(value: PgValueRef<'r>) -> Result<Self, BoxDynError> {
let element_type_info;
Expand Down
2 changes: 0 additions & 2 deletions sqlx-core/src/sqlite/options/auto_vacuum.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::str::FromStr;

#[derive(Debug, Clone)]
pub enum SqliteAutoVacuum {
None,
Expand Down
2 changes: 0 additions & 2 deletions sqlx-core/src/sqlite/options/locking_mode.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::str::FromStr;

#[derive(Debug, Clone)]
pub enum SqliteLockingMode {
Normal,
Expand Down
3 changes: 0 additions & 3 deletions sqlx-core/src/types/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ where

impl<'q, DB> Encode<'q, DB> for JsonValue
where
Self: Type<DB>,
for<'a> Json<&'a Self>: Encode<'q, DB>,
DB: Database,
{
Expand All @@ -97,7 +96,6 @@ where

impl<'r, DB> Decode<'r, DB> for JsonValue
where
Self: Type<DB>,
Json<Self>: Decode<'r, DB>,
DB: Database,
{
Expand All @@ -124,7 +122,6 @@ where
// implementation for Encode
impl<'r, DB> Decode<'r, DB> for &'r JsonRawValue
where
Self: Type<DB>,
Json<Self>: Decode<'r, DB>,
DB: Database,
{
Expand Down
2 changes: 1 addition & 1 deletion sqlx-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mod tokio_runtime {
where
F: FnOnce() -> R,
{
RUNTIME.enter();
let _rt = RUNTIME.enter();
f()
}
}
Expand Down