Update to edition 2021 (#1808)

* Update to edition 2021

* Fix running tests
This commit is contained in:
Paolo Barbolini 2022-04-15 21:52:00 +02:00 committed by GitHub
parent fee8c60fe0
commit fc9c9be5e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 31 additions and 45 deletions

View File

@ -24,7 +24,7 @@ readme = "README.md"
repository = "https://github.com/launchbadge/sqlx"
documentation = "https://docs.rs/sqlx"
description = "🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite."
edition = "2018"
edition = "2021"
keywords = ["database", "async", "postgres", "mysql", "sqlite"]
categories = ["database", "asynchronous"]
authors = [

View File

@ -1,7 +1,7 @@
[package]
name = "sqlx-example-mysql-todos"
version = "0.1.0"
edition = "2018"
edition = "2021"
workspace = "../../../"
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "json"
version = "0.1.0"
edition = "2018"
edition = "2021"
workspace = "../../../"
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "sqlx-example-postgres-listen"
version = "0.1.0"
edition = "2018"
edition = "2021"
workspace = "../../../"
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "sqlx-example-postgres-mockable-todos"
version = "0.1.0"
edition = "2018"
edition = "2021"
workspace = "../../../"
[dependencies]

View File

@ -1,7 +1,7 @@
[package]
name = "sqlx-example-postgres-transaction"
version = "0.1.0"
edition = "2018"
edition = "2021"
workspace = "../../../"
[dependencies]

View File

@ -2,7 +2,7 @@
name = "sqlx-bench"
version = "0.1.0"
authors = ["Austin Bonander <austin@launchbadge.com>"]
edition = "2018"
edition = "2021"
publish = false
[features]

View File

@ -2,7 +2,7 @@
name = "sqlx-cli"
version = "0.5.12"
description = "Command-line utility for SQLx, the Rust SQL toolkit."
edition = "2018"
edition = "2021"
readme = "README.md"
homepage = "https://github.com/launchbadge/sqlx"
repository = "https://github.com/launchbadge/sqlx"

View File

@ -4,7 +4,7 @@ version = "0.5.12"
repository = "https://github.com/launchbadge/sqlx"
description = "Core of SQLx, the rust SQL toolkit. Not intended to be used directly."
license = "MIT OR Apache-2.0"
edition = "2018"
edition = "2021"
authors = [
"Ryan Leckey <leckey.ryan@gmail.com>",
"Austin Bonander <austin.bonander@gmail.com>",
@ -67,27 +67,41 @@ json = ["serde", "serde_json"]
# runtimes
runtime-actix-native-tls = [
"sqlx-rt/runtime-actix-native-tls",
"sqlx/runtime-actix-native-tls",
"_tls-native-tls",
"_rt-actix",
]
runtime-async-std-native-tls = [
"sqlx-rt/runtime-async-std-native-tls",
"sqlx/runtime-async-std-native-tls",
"_tls-native-tls",
"_rt-async-std",
]
runtime-tokio-native-tls = [
"sqlx-rt/runtime-tokio-native-tls",
"sqlx/runtime-tokio-native-tls",
"_tls-native-tls",
"_rt-tokio",
]
runtime-actix-rustls = ["sqlx-rt/runtime-actix-rustls", "_tls-rustls", "_rt-actix"]
runtime-actix-rustls = [
"sqlx-rt/runtime-actix-rustls",
"sqlx/runtime-actix-rustls",
"_tls-rustls",
"_rt-actix"
]
runtime-async-std-rustls = [
"sqlx-rt/runtime-async-std-rustls",
"sqlx/runtime-async-std-rustls",
"_tls-rustls",
"_rt-async-std",
]
runtime-tokio-rustls = ["sqlx-rt/runtime-tokio-rustls", "_tls-rustls", "_rt-tokio"]
runtime-tokio-rustls = [
"sqlx-rt/runtime-tokio-rustls",
"sqlx/runtime-tokio-rustls",
"_tls-rustls",
"_rt-tokio"
]
# for conditional compilation
_rt-actix = ["tokio-stream"]
@ -103,7 +117,7 @@ offline = ["serde", "either/serde"]
paste = "1.0.6"
ahash = "0.7.6"
atoi = "0.4.0"
sqlx-rt = { path = "../sqlx-rt", version = "0.5.12"}
sqlx-rt = { path = "../sqlx-rt", version = "0.5.12" }
base64 = { version = "0.13.0", default-features = false, optional = true, features = ["std"] }
bigdecimal_ = { version = "0.3.0", optional = true, package = "bigdecimal" }
rust_decimal = { version = "1.19.0", optional = true }

View File

@ -3,7 +3,6 @@ use crate::connection::ConnectOptions;
use crate::error::Error;
use futures_core::future::BoxFuture;
use log::LevelFilter;
use std::convert::TryFrom;
use std::str::FromStr;
use std::time::Duration;

View File

@ -1,5 +1,3 @@
use std::convert::TryFrom;
use bytes::Buf;
use chrono::{DateTime, Datelike, Local, NaiveDate, NaiveDateTime, NaiveTime, Timelike, Utc};

View File

@ -1,5 +1,3 @@
use std::convert::TryInto;
use byteorder::{ByteOrder, LittleEndian};
use crate::decode::Decode;

View File

@ -1,5 +1,3 @@
use std::convert::TryFrom;
use byteorder::{ByteOrder, LittleEndian};
use bytes::Buf;
use time::macros::format_description;

View File

@ -5,7 +5,6 @@ use crate::mysql::protocol::text::{ColumnFlags, ColumnType};
use crate::mysql::{MySql, MySqlTypeInfo, MySqlValueFormat, MySqlValueRef};
use crate::types::Type;
use byteorder::{ByteOrder, LittleEndian};
use std::convert::TryInto;
fn uint_type_info(ty: ColumnType) -> MySqlTypeInfo {
MySqlTypeInfo {

View File

@ -1,6 +1,5 @@
#![allow(dead_code)]
use std::convert::TryFrom;
use std::io;
use std::ops::{Deref, DerefMut};
use std::path::PathBuf;

View File

@ -10,7 +10,6 @@ use crate::query_scalar::{query_scalar, query_scalar_with};
use crate::types::Json;
use crate::HashMap;
use futures_core::future::BoxFuture;
use std::convert::TryFrom;
use std::fmt::Write;
use std::sync::Arc;

View File

@ -10,7 +10,6 @@ use bytes::{BufMut, Bytes};
use futures_core::stream::BoxStream;
use smallvec::alloc::borrow::Cow;
use sqlx_rt::{AsyncRead, AsyncReadExt, AsyncWriteExt};
use std::convert::TryFrom;
use std::ops::{Deref, DerefMut};
impl PgConnection {

View File

@ -26,7 +26,7 @@ impl PgSeverity {
}
}
impl std::convert::TryFrom<&str> for PgSeverity {
impl TryFrom<&str> for PgSeverity {
type Error = Error;
fn try_from(s: &str) -> Result<PgSeverity, Error> {
@ -131,7 +131,6 @@ impl Decode<'_> for Notice {
break;
}
use std::convert::TryInto;
match field {
b'S' => {
// Discard potential errors, because the message might be localized

View File

@ -1,5 +1,4 @@
use std::cmp;
use std::convert::{TryFrom, TryInto};
use bigdecimal::BigDecimal;
use num_bigint::{BigInt, Sign};

View File

@ -3,7 +3,6 @@ use rust_decimal::{
prelude::{ToPrimitive, Zero},
Decimal,
};
use std::convert::{TryFrom, TryInto};
use crate::decode::Decode;
use crate::encode::{Encode, IsNull};

View File

@ -1,4 +1,3 @@
use std::convert::{TryFrom, TryInto};
use std::mem;
use byteorder::{NetworkEndian, ReadBytesExt};

View File

@ -1,7 +1,5 @@
use mac_address::MacAddress;
use std::convert::TryInto;
use crate::decode::Decode;
use crate::encode::{Encode, IsNull};
use crate::error::BoxDynError;

View File

@ -96,8 +96,6 @@ impl PgMoney {
/// [`Decimal`]: crate::types::Decimal
#[cfg(feature = "decimal")]
pub fn from_decimal(mut decimal: rust_decimal::Decimal, locale_frac_digits: u32) -> Self {
use std::convert::TryFrom;
// this is all we need to convert to our expected locale's `frac_digits`
decimal.rescale(locale_frac_digits);

View File

@ -1,5 +1,3 @@
use std::convert::TryInto;
use bytes::Buf;
use crate::error::BoxDynError;

View File

@ -10,12 +10,9 @@ use libsqlite3_sys::{
};
use std::ffi::CString;
use std::io;
use std::ptr::{null, null_mut};
use std::sync::atomic::{AtomicU64, Ordering};
use std::time::Duration;
use std::{
convert::TryFrom,
ptr::{null, null_mut},
};
static THREAD_ID: AtomicU64 = AtomicU64::new(0);

View File

@ -1,5 +1,3 @@
use std::convert::TryInto;
use crate::decode::Decode;
use crate::encode::{Encode, IsNull};
use crate::error::BoxDynError;

View File

@ -1,5 +1,3 @@
use std::convert::TryInto;
use crate::decode::Decode;
use crate::encode::{Encode, IsNull};
use crate::error::BoxDynError;

View File

@ -4,7 +4,7 @@ version = "0.5.12"
repository = "https://github.com/launchbadge/sqlx"
description = "Macros for SQLx, the rust SQL toolkit. Not intended to be used directly."
license = "MIT OR Apache-2.0"
edition = "2018"
edition = "2021"
authors = [
"Ryan Leckey <leckey.ryan@gmail.com>",
"Austin Bonander <austin.bonander@gmail.com>",

View File

@ -4,7 +4,7 @@ version = "0.5.12"
repository = "https://github.com/launchbadge/sqlx"
license = "MIT OR Apache-2.0"
description = "Runtime abstraction used by SQLx, the Rust SQL toolkit. Not intended to be used directly."
edition = "2018"
edition = "2021"
authors = [
"Ryan Leckey <leckey.ryan@gmail.com>",
"Austin Bonander <austin.bonander@gmail.com>",

View File

@ -1,7 +1,7 @@
[package]
name = "sqlx-test"
version = "0.1.0"
edition = "2018"
edition = "2021"
publish = false
[dependencies]