Skip to content

Commit 05d64fb

Browse files
authored
fix: agree one a single default runtime for the whole workspace (#1988)
This fixes `cargo check --workspace` and rust-analyzer. Also see <#1956>.
1 parent 29073cb commit 05d64fb

File tree

20 files changed

+51
-89
lines changed

20 files changed

+51
-89
lines changed

Cargo.lock

+11-43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ authors = [
3636
]
3737

3838
[package.metadata.docs.rs]
39-
features = ["all", "runtime-async-std-native-tls"]
39+
features = ["all", "runtime-tokio-native-tls"]
4040
rustdoc-args = ["--cfg", "docsrs"]
4141

4242
[features]

examples/mysql/todos/Cargo.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ workspace = "../../../"
66

77
[dependencies]
88
anyhow = "1.0"
9-
async-std = { version = "1.8.0", features = [ "attributes" ] }
109
futures = "0.3"
11-
paw = "1.0"
12-
sqlx = { path = "../../../", features = [ "mysql", "runtime-async-std-native-tls" ] }
13-
structopt = { version = "0.3", features = [ "paw" ] }
10+
sqlx = { path = "../../../", features = [ "mysql", "runtime-tokio-native-tls" ] }
11+
structopt = "0.3"
12+
tokio = { version = "1.20.0", features = ["macros"]}

examples/mysql/todos/src/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ enum Command {
1414
Done { id: u64 },
1515
}
1616

17-
#[async_std::main]
18-
#[paw::main]
19-
async fn main(args: Args) -> anyhow::Result<()> {
17+
#[tokio::main]
18+
async fn main() -> anyhow::Result<()> {
19+
let args = Args::from_args_safe()?;
2020
let pool = MySqlPool::connect(&env::var("DATABASE_URL")?).await?;
2121

2222
match args.cmd {

examples/postgres/files/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ edition = "2021"
77

88
[dependencies]
99
anyhow = "1.0"
10-
async-std = { version = "1.8.0", features = [ "attributes" ] }
11-
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-async-std-native-tls"] }
10+
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-tokio-native-tls"] }
11+
tokio = { version = "1.20.0", features = ["macros"]}
1212
dotenv = "0.15.0"

examples/postgres/files/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl Display for PostWithAuthorQuery {
2626
}
2727
}
2828

29-
#[async_std::main]
29+
#[tokio::main]
3030
async fn main() -> anyhow::Result<()> {
3131
let pool = PgPool::connect(&dotenv::var("DATABASE_URL")?).await?;
3232

examples/postgres/json/Cargo.toml

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ workspace = "../../../"
66

77
[dependencies]
88
anyhow = "1.0"
9-
async-std = { version = "1.6.0", features = [ "attributes" ] }
109
dotenv = "0.15.0"
1110
futures = "0.3"
12-
paw = "1.0"
1311
serde = { version = "1", features = ["derive"] }
1412
serde_json = "1"
1513
sqlx = { path = "../../../", features = ["postgres", "json"] }
16-
structopt = { version = "0.3", features = ["paw"] }
14+
structopt = "0.3"
15+
tokio = { version = "1.20.0", features = ["macros"]}

examples/postgres/json/src/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ struct Row {
3030
person: Json<Person>,
3131
}
3232

33-
#[async_std::main]
34-
#[paw::main]
35-
async fn main(args: Args) -> anyhow::Result<()> {
33+
#[tokio::main]
34+
async fn main() -> anyhow::Result<()> {
35+
let args = Args::from_args_safe()?;
3636
let pool = PgPool::connect(&dotenv::var("DATABASE_URL")?).await?;
3737

3838
match args.cmd {

examples/postgres/listen/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ edition = "2021"
55
workspace = "../../../"
66

77
[dependencies]
8-
async-std = { version = "1.8.0", features = [ "attributes", "unstable" ] }
98
sqlx = { path = "../../../", features = [ "postgres", "tls" ] }
109
futures = "0.3.1"
10+
tokio = { version = "1.20.0", features = ["macros"]}

examples/postgres/listen/src/main.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
use async_std::stream;
21
use futures::StreamExt;
32
use futures::TryStreamExt;
43
use sqlx::postgres::PgListener;
54
use sqlx::{Executor, PgPool};
65
use std::sync::atomic::{AtomicI64, Ordering};
76
use std::time::Duration;
87

9-
#[async_std::main]
8+
#[tokio::main]
109
async fn main() -> Result<(), Box<dyn std::error::Error>> {
1110
println!("Building PG pool.");
1211
let conn_str =

examples/postgres/mockable-todos/Cargo.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ workspace = "../../../"
66

77
[dependencies]
88
anyhow = "1.0"
9-
async-std = { version = "1.4.0", features = [ "attributes" ] }
109
futures = "0.3"
11-
paw = "1.0"
12-
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-async-std-native-tls"] }
13-
structopt = { version = "0.3", features = ["paw"] }
10+
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-tokio-native-tls"] }
11+
structopt = "0.3"
12+
tokio = { version = "1.20.0", features = ["macros"]}
1413
dotenv = "0.15.0"
1514
async-trait = "0.1.41"
1615
mockall = "0.11"

examples/postgres/mockable-todos/src/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ enum Command {
1616
Done { id: i64 },
1717
}
1818

19-
#[async_std::main]
20-
#[paw::main]
21-
async fn main(args: Args) -> anyhow::Result<()> {
19+
#[tokio::main]
20+
async fn main() -> anyhow::Result<()> {
2221
dotenv::dotenv().ok();
22+
let args = Args::from_args_safe()?;
2323
let pool = PgPool::connect(&env::var("DATABASE_URL")?).await?;
2424
let todo_repo = PostgresTodoRepo::new(pool);
2525
let mut writer = std::io::stdout();

examples/postgres/todos/Cargo.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ workspace = "../../../"
66

77
[dependencies]
88
anyhow = "1.0"
9-
async-std = { version = "1.8.0", features = [ "attributes" ] }
109
futures = "0.3"
11-
paw = "1.0"
12-
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-async-std-native-tls"] }
13-
structopt = { version = "0.3", features = ["paw"] }
10+
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-tokio-native-tls"] }
11+
structopt = "0.3"
12+
tokio = { version = "1.20.0", features = ["macros"]}
1413
dotenv = "0.15.0"

examples/postgres/todos/src/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ enum Command {
1414
Done { id: i64 },
1515
}
1616

17-
#[async_std::main]
18-
#[paw::main]
19-
async fn main(args: Args) -> anyhow::Result<()> {
17+
#[tokio::main]
18+
async fn main() -> anyhow::Result<()> {
19+
let args = Args::from_args_safe()?;
2020
let pool = PgPool::connect(&env::var("DATABASE_URL")?).await?;
2121

2222
match args.cmd {

examples/postgres/transaction/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ edition = "2021"
55
workspace = "../../../"
66

77
[dependencies]
8-
async-std = { version = "1.8.0", features = [ "attributes", "unstable" ] }
9-
sqlx = { path = "../../../", features = [ "postgres", "tls", "runtime-async-std-native-tls" ] }
8+
sqlx = { path = "../../../", features = [ "postgres", "tls", "runtime-tokio-native-tls" ] }
109
futures = "0.3.1"
10+
tokio = { version = "1.20.0", features = ["macros"]}

examples/postgres/transaction/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async fn commit_example(
6060
Ok(())
6161
}
6262

63-
#[async_std::main]
63+
#[tokio::main]
6464
async fn main() -> Result<(), Box<dyn std::error::Error>> {
6565
let conn_str =
6666
std::env::var("DATABASE_URL").expect("Env var DATABASE_URL is required for this example.");

examples/sqlite/todos/Cargo.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ workspace = "../../../"
66

77
[dependencies]
88
anyhow = "1.0"
9-
async-std = { version = "1.8.0", features = [ "attributes" ] }
109
futures = "0.3"
11-
paw = "1.0"
12-
sqlx = { path = "../../../", features = ["sqlite"] }
13-
structopt = { version = "0.3", features = ["paw"] }
10+
sqlx = { path = "../../../", features = ["sqlite", "runtime-tokio-native-tls"] }
11+
structopt = "0.3"
12+
tokio = { version = "1.20.0", features = ["macros"]}

examples/sqlite/todos/src/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ enum Command {
1414
Done { id: i64 },
1515
}
1616

17-
#[async_std::main]
18-
#[paw::main]
19-
async fn main(args: Args) -> anyhow::Result<()> {
17+
#[tokio::main]
18+
async fn main() -> anyhow::Result<()> {
19+
let args = Args::from_args_safe()?;
2020
let pool = SqlitePool::connect(&env::var("DATABASE_URL")?).await?;
2121

2222
match args.cmd {

sqlx-core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ authors = [
1313
]
1414

1515
[package.metadata.docs.rs]
16-
features = ["all-databases", "all-types", "offline", "runtime-async-std-native-tls"]
16+
features = ["all-databases", "all-types", "offline", "runtime-tokio-native-tls"]
1717

1818
[features]
1919
default = ["migrate"]

sqlx-macros/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ authors = [
1616
proc-macro = true
1717

1818
[features]
19-
default = ["runtime-async-std-native-tls", "migrate"]
19+
default = ["runtime-tokio-native-tls", "migrate"]
2020
migrate = ["sha2", "sqlx-core/migrate"]
2121

2222
# runtimes

0 commit comments

Comments
 (0)