summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml1
-rw-r--r--src/main.rs5
2 files changed, 2 insertions, 4 deletions
diff --git a/Cargo.toml b/Cargo.toml
index d04df4b..495965a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,5 +9,4 @@ license = "MIT"
actix-web = "3.2.0"
serde = { version = "1.0", features = ["derive"] }
csv = "1.1"
-anyhow = "1.0.34"
rand = "0.7.3"
diff --git a/src/main.rs b/src/main.rs
index 3b8e2d0..d0bfdc8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,5 +1,4 @@
use actix_web::{get, web, App, HttpResponse, HttpServer, Responder};
-use anyhow::Result;
use rand::seq::SliceRandom;
use serde::Deserialize;
@@ -9,7 +8,7 @@ struct Config {
}
impl Config {
- fn load_from<R: std::io::Read>(reader: R) -> Result<Self> {
+ fn load_from<R: std::io::Read>(reader: R) -> std::io::Result<Self> {
let mut rdr = csv::ReaderBuilder::new()
.trim(csv::Trim::All)
.from_reader(reader);
@@ -75,7 +74,7 @@ async fn search(config: web::Data<Config>, web::Path(query): web::Path<String>)
#[actix_web::main]
async fn main() -> std::io::Result<()> {
- let f = std::fs::File::open("search_engines.csv").unwrap();
+ let f = std::fs::File::open("search_engines.csv")?;
let config = Config::load_from(f).unwrap();
HttpServer::new(move || App::new().data(config.clone()).service(search))