Skip to content

Commit

Permalink
fix: agree one a single default runtime for the whole workspace (#1988)
Browse files Browse the repository at this point in the history
This fixes `cargo check --workspace` and rust-analyzer.

Also see <#1956>.
  • Loading branch information
crepererum authored Jul 28, 2022
1 parent 29073cb commit 05d64fb
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 89 deletions.
54 changes: 11 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ authors = [
]

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

[features]
Expand Down
7 changes: 3 additions & 4 deletions examples/mysql/todos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ workspace = "../../../"

[dependencies]
anyhow = "1.0"
async-std = { version = "1.8.0", features = [ "attributes" ] }
futures = "0.3"
paw = "1.0"
sqlx = { path = "../../../", features = [ "mysql", "runtime-async-std-native-tls" ] }
structopt = { version = "0.3", features = [ "paw" ] }
sqlx = { path = "../../../", features = [ "mysql", "runtime-tokio-native-tls" ] }
structopt = "0.3"
tokio = { version = "1.20.0", features = ["macros"]}
6 changes: 3 additions & 3 deletions examples/mysql/todos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ enum Command {
Done { id: u64 },
}

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

match args.cmd {
Expand Down
4 changes: 2 additions & 2 deletions examples/postgres/files/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ edition = "2021"

[dependencies]
anyhow = "1.0"
async-std = { version = "1.8.0", features = [ "attributes" ] }
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-async-std-native-tls"] }
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-tokio-native-tls"] }
tokio = { version = "1.20.0", features = ["macros"]}
dotenv = "0.15.0"
2 changes: 1 addition & 1 deletion examples/postgres/files/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Display for PostWithAuthorQuery {
}
}

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

Expand Down
5 changes: 2 additions & 3 deletions examples/postgres/json/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ workspace = "../../../"

[dependencies]
anyhow = "1.0"
async-std = { version = "1.6.0", features = [ "attributes" ] }
dotenv = "0.15.0"
futures = "0.3"
paw = "1.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sqlx = { path = "../../../", features = ["postgres", "json"] }
structopt = { version = "0.3", features = ["paw"] }
structopt = "0.3"
tokio = { version = "1.20.0", features = ["macros"]}
6 changes: 3 additions & 3 deletions examples/postgres/json/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ struct Row {
person: Json<Person>,
}

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

match args.cmd {
Expand Down
2 changes: 1 addition & 1 deletion examples/postgres/listen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ edition = "2021"
workspace = "../../../"

[dependencies]
async-std = { version = "1.8.0", features = [ "attributes", "unstable" ] }
sqlx = { path = "../../../", features = [ "postgres", "tls" ] }
futures = "0.3.1"
tokio = { version = "1.20.0", features = ["macros"]}
3 changes: 1 addition & 2 deletions examples/postgres/listen/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use async_std::stream;
use futures::StreamExt;
use futures::TryStreamExt;
use sqlx::postgres::PgListener;
use sqlx::{Executor, PgPool};
use std::sync::atomic::{AtomicI64, Ordering};
use std::time::Duration;

#[async_std::main]
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Building PG pool.");
let conn_str =
Expand Down
7 changes: 3 additions & 4 deletions examples/postgres/mockable-todos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ workspace = "../../../"

[dependencies]
anyhow = "1.0"
async-std = { version = "1.4.0", features = [ "attributes" ] }
futures = "0.3"
paw = "1.0"
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-async-std-native-tls"] }
structopt = { version = "0.3", features = ["paw"] }
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-tokio-native-tls"] }
structopt = "0.3"
tokio = { version = "1.20.0", features = ["macros"]}
dotenv = "0.15.0"
async-trait = "0.1.41"
mockall = "0.11"
6 changes: 3 additions & 3 deletions examples/postgres/mockable-todos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ enum Command {
Done { id: i64 },
}

#[async_std::main]
#[paw::main]
async fn main(args: Args) -> anyhow::Result<()> {
#[tokio::main]
async fn main() -> anyhow::Result<()> {
dotenv::dotenv().ok();
let args = Args::from_args_safe()?;
let pool = PgPool::connect(&env::var("DATABASE_URL")?).await?;
let todo_repo = PostgresTodoRepo::new(pool);
let mut writer = std::io::stdout();
Expand Down
7 changes: 3 additions & 4 deletions examples/postgres/todos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ workspace = "../../../"

[dependencies]
anyhow = "1.0"
async-std = { version = "1.8.0", features = [ "attributes" ] }
futures = "0.3"
paw = "1.0"
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-async-std-native-tls"] }
structopt = { version = "0.3", features = ["paw"] }
sqlx = { path = "../../../", features = ["postgres", "offline", "runtime-tokio-native-tls"] }
structopt = "0.3"
tokio = { version = "1.20.0", features = ["macros"]}
dotenv = "0.15.0"
6 changes: 3 additions & 3 deletions examples/postgres/todos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ enum Command {
Done { id: i64 },
}

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

match args.cmd {
Expand Down
4 changes: 2 additions & 2 deletions examples/postgres/transaction/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ edition = "2021"
workspace = "../../../"

[dependencies]
async-std = { version = "1.8.0", features = [ "attributes", "unstable" ] }
sqlx = { path = "../../../", features = [ "postgres", "tls", "runtime-async-std-native-tls" ] }
sqlx = { path = "../../../", features = [ "postgres", "tls", "runtime-tokio-native-tls" ] }
futures = "0.3.1"
tokio = { version = "1.20.0", features = ["macros"]}
2 changes: 1 addition & 1 deletion examples/postgres/transaction/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async fn commit_example(
Ok(())
}

#[async_std::main]
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let conn_str =
std::env::var("DATABASE_URL").expect("Env var DATABASE_URL is required for this example.");
Expand Down
7 changes: 3 additions & 4 deletions examples/sqlite/todos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ workspace = "../../../"

[dependencies]
anyhow = "1.0"
async-std = { version = "1.8.0", features = [ "attributes" ] }
futures = "0.3"
paw = "1.0"
sqlx = { path = "../../../", features = ["sqlite"] }
structopt = { version = "0.3", features = ["paw"] }
sqlx = { path = "../../../", features = ["sqlite", "runtime-tokio-native-tls"] }
structopt = "0.3"
tokio = { version = "1.20.0", features = ["macros"]}
6 changes: 3 additions & 3 deletions examples/sqlite/todos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ enum Command {
Done { id: i64 },
}

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

match args.cmd {
Expand Down
2 changes: 1 addition & 1 deletion sqlx-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ authors = [
]

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

[features]
default = ["migrate"]
Expand Down
2 changes: 1 addition & 1 deletion sqlx-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ authors = [
proc-macro = true

[features]
default = ["runtime-async-std-native-tls", "migrate"]
default = ["runtime-tokio-native-tls", "migrate"]
migrate = ["sha2", "sqlx-core/migrate"]

# runtimes
Expand Down

0 comments on commit 05d64fb

Please sign in to comment.