Skip to content

Commit

Permalink
Update to edition 2021 (#1808)
Browse files Browse the repository at this point in the history
* Update to edition 2021

* Fix running tests
  • Loading branch information
paolobarbolini authored Apr 15, 2022
1 parent fee8c60 commit fc9c9be
Show file tree
Hide file tree
Showing 30 changed files with 31 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion examples/mysql/todos/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sqlx-example-mysql-todos"
version = "0.1.0"
edition = "2018"
edition = "2021"
workspace = "../../../"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/postgres/json/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "json"
version = "0.1.0"
edition = "2018"
edition = "2021"
workspace = "../../../"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/postgres/listen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sqlx-example-postgres-listen"
version = "0.1.0"
edition = "2018"
edition = "2021"
workspace = "../../../"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/postgres/mockable-todos/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sqlx-example-postgres-mockable-todos"
version = "0.1.0"
edition = "2018"
edition = "2021"
workspace = "../../../"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/postgres/transaction/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sqlx-example-postgres-transaction"
version = "0.1.0"
edition = "2018"
edition = "2021"
workspace = "../../../"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion sqlx-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "sqlx-bench"
version = "0.1.0"
authors = ["Austin Bonander <austin@launchbadge.com>"]
edition = "2018"
edition = "2021"
publish = false

[features]
Expand Down
2 changes: 1 addition & 1 deletion sqlx-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
22 changes: 18 additions & 4 deletions sqlx-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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>",
Expand Down Expand Up @@ -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"]
Expand All @@ -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 }
Expand Down
1 change: 0 additions & 1 deletion sqlx-core/src/any/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions sqlx-core/src/mysql/types/chrono.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryFrom;

use bytes::Buf;
use chrono::{DateTime, Datelike, Local, NaiveDate, NaiveDateTime, NaiveTime, Timelike, Utc};

Expand Down
2 changes: 0 additions & 2 deletions sqlx-core/src/mysql/types/int.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryInto;

use byteorder::{ByteOrder, LittleEndian};

use crate::decode::Decode;
Expand Down
2 changes: 0 additions & 2 deletions sqlx-core/src/mysql/types/time.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryFrom;

use byteorder::{ByteOrder, LittleEndian};
use bytes::Buf;
use time::macros::format_description;
Expand Down
1 change: 0 additions & 1 deletion sqlx-core/src/mysql/types/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion sqlx-core/src/net/tls/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(dead_code)]

use std::convert::TryFrom;
use std::io;
use std::ops::{Deref, DerefMut};
use std::path::PathBuf;
Expand Down
1 change: 0 additions & 1 deletion sqlx-core/src/postgres/connection/describe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion sqlx-core/src/postgres/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions sqlx-core/src/postgres/message/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion sqlx-core/src/postgres/types/bigdecimal.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::cmp;
use std::convert::{TryFrom, TryInto};

use bigdecimal::BigDecimal;
use num_bigint::{BigInt, Sign};
Expand Down
1 change: 0 additions & 1 deletion sqlx-core/src/postgres/types/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
1 change: 0 additions & 1 deletion sqlx-core/src/postgres/types/interval.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::convert::{TryFrom, TryInto};
use std::mem;

use byteorder::{NetworkEndian, ReadBytesExt};
Expand Down
2 changes: 0 additions & 2 deletions sqlx-core/src/postgres/types/mac_address.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 0 additions & 2 deletions sqlx-core/src/postgres/types/money.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions sqlx-core/src/postgres/types/numeric.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryInto;

use bytes::Buf;

use crate::error::BoxDynError;
Expand Down
5 changes: 1 addition & 4 deletions sqlx-core/src/sqlite/connection/establish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions sqlx-core/src/sqlite/types/int.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryInto;

use crate::decode::Decode;
use crate::encode::{Encode, IsNull};
use crate::error::BoxDynError;
Expand Down
2 changes: 0 additions & 2 deletions sqlx-core/src/sqlite/types/uint.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryInto;

use crate::decode::Decode;
use crate::encode::{Encode, IsNull};
use crate::error::BoxDynError;
Expand Down
2 changes: 1 addition & 1 deletion sqlx-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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>",
Expand Down
2 changes: 1 addition & 1 deletion sqlx-rt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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>",
Expand Down
2 changes: 1 addition & 1 deletion sqlx-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sqlx-test"
version = "0.1.0"
edition = "2018"
edition = "2021"
publish = false

[dependencies]
Expand Down

0 comments on commit fc9c9be

Please sign in to comment.