diff --git a/server/src/adf.rs b/server/src/adf.rs index 32180e7..cd2f3fb 100644 --- a/server/src/adf.rs +++ b/server/src/adf.rs @@ -44,9 +44,9 @@ pub(crate) struct AcAndGraph { pub(crate) graph: DoubleLabeledGraph, } -impl Into for AcAndGraph { - fn into(self) -> Bson { - to_bson(&self).expect("Serialization should work") +impl From for Bson { + fn from(source: AcAndGraph) -> Self { + to_bson(&source).expect("Serialization should work") } } @@ -297,9 +297,7 @@ async fn add_adf_problem( Parsing::Naive => Adf::from_parser(&parser), Parsing::Hybrid => { let bd_adf = BdAdf::from_parser(&parser); - let naive_adf = bd_adf.hybrid_step_opt(false); - - naive_adf + bd_adf.hybrid_step_opt(false) } }; @@ -324,8 +322,7 @@ async fn add_adf_problem( Ok(Err(err)) => HttpResponse::InternalServerError().body(err.to_string()), Ok(Ok(Err(err))) => HttpResponse::InternalServerError().body(err.to_string()), Ok(Ok(Ok((adf, ac_and_graph)))) => { - let mut acs = AcsPerStrategy::default(); - acs.parse_only = Some(vec![ac_and_graph]); + let acs = AcsPerStrategy { parse_only: Some(vec![ac_and_graph]), ..Default::default()}; let adf_problem: AdfProblem = AdfProblem { name: problem_name, diff --git a/server/src/main.rs b/server/src/main.rs index b2d1545..c513c90 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -40,7 +40,7 @@ async fn main() -> std::io::Result<()> { // cookie secret ket let secret_key = Key::generate(); - let server = HttpServer::new(move || { + HttpServer::new(move || { let app = App::new(); #[cfg(feature = "cors_for_local_development")] @@ -89,7 +89,5 @@ async fn main() -> std::io::Result<()> { }) .bind(("0.0.0.0", 8080))? .run() - .await; - - server + .await } diff --git a/server/src/user.rs b/server/src/user.rs index 8371dc0..35d40ce 100644 --- a/server/src/user.rs +++ b/server/src/user.rs @@ -280,7 +280,7 @@ async fn update_user( Some(id) => match id.id() { Err(err) => HttpResponse::InternalServerError().body(err.to_string()), Ok(username) => { - if &user.username != &username && username_exists(&user_coll, &user.username).await + if user.username != username && username_exists(&user_coll, &user.username).await { return HttpResponse::Conflict() .body("Username is already taken. Please pick another one!");