diff --git a/Cargo.lock b/Cargo.lock index 29a16f4..dda6ab1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -334,12 +334,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "anyhow" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fd36ffbb1fb7c834eac128ea8d0e310c5aeb635548f9d58861e1308d46e71c" - [[package]] name = "arc-swap" version = "0.4.7" @@ -529,7 +523,6 @@ version = "0.1.0" dependencies = [ "actix-rt", "actix-web", - "anyhow", "chrono", "config", "reqwest", @@ -545,7 +538,6 @@ version = "0.1.0" dependencies = [ "actix-rt", "actix-web", - "anyhow", "chrono", "config", "lazy_static", diff --git a/chapter03-1/Cargo.toml b/chapter03-1/Cargo.toml index f8fcc53..43bae14 100644 --- a/chapter03-1/Cargo.toml +++ b/chapter03-1/Cargo.toml @@ -19,7 +19,6 @@ tokio = "0.2.22" serde = "1.0.115" config = { version = "0.10.1", default-features = false, features = ["yaml"] } sqlx = { version = "0.4.0-beta.1", default-features = false, features = [ "runtime-tokio", "macros", "postgres", "uuid", "chrono", "migrate"] } -anyhow = "1.0.32" uuid = { version = "0.8.1", features = ["v4"] } chrono = "0.4.15" diff --git a/chapter03-1/src/main.rs b/chapter03-1/src/main.rs index 722760f..b4f54f4 100644 --- a/chapter03-1/src/main.rs +++ b/chapter03-1/src/main.rs @@ -1,16 +1,14 @@ -use anyhow::Context; use chapter03_1::configuration::get_configuration; use chapter03_1::startup::run; use sqlx::postgres::PgPool; use std::net::TcpListener; #[actix_rt::main] -async fn main() -> Result<(), anyhow::Error> { +async fn main() -> std::io::Result<()> { let configuration = get_configuration().expect("Failed to read configuration."); let connection_pool = PgPool::connect(&configuration.database.connection_string()) .await - .map_err(anyhow::Error::from) - .with_context(|| "Failed to connect to Postgres.")?; + .expect("Failed to connect to Postgres."); // Here we choose to bind explicitly to localhost, 127.0.0.1, for security // reasons. This binding may cause issues in some environments. For example, diff --git a/chapter04/Cargo.toml b/chapter04/Cargo.toml index ab9a5af..4beefe0 100644 --- a/chapter04/Cargo.toml +++ b/chapter04/Cargo.toml @@ -19,7 +19,6 @@ tokio = "0.2.22" serde = "1.0.115" config = { version = "0.10.1", default-features = false, features = ["yaml"] } sqlx = { version = "0.4.0-beta.1", default-features = false, features = [ "runtime-tokio", "macros", "postgres", "uuid", "chrono", "migrate"] } -anyhow = "1.0.32" uuid = { version = "0.8.1", features = ["v4"] } chrono = "0.4.15" tracing = "0.1.19" diff --git a/chapter04/src/main.rs b/chapter04/src/main.rs index a7a516b..6d032d2 100644 --- a/chapter04/src/main.rs +++ b/chapter04/src/main.rs @@ -1,4 +1,3 @@ -use anyhow::Context; use chapter04::configuration::get_configuration; use chapter04::startup::run; use chapter04::telemetry::{get_subscriber, init_subscriber}; @@ -6,15 +5,14 @@ use sqlx::postgres::PgPool; use std::net::TcpListener; #[actix_rt::main] -async fn main() -> Result<(), anyhow::Error> { +async fn main() -> std::io::Result<()> { let subscriber = get_subscriber("zero2prod".into(), "info".into()); init_subscriber(subscriber); let configuration = get_configuration().expect("Failed to read configuration."); let connection_pool = PgPool::connect(&configuration.database.connection_string()) .await - .map_err(anyhow::Error::from) - .with_context(|| "Failed to connect to Postgres.")?; + .expect("Failed to connect to Postgres."); // Here we choose to bind explicitly to localhost, 127.0.0.1, for security // reasons. This binding may cause issues in some environments. For example,