1
0
mirror of https://github.com/ellmau/adf-obdd.git synced 2025-12-20 09:39:38 +01:00

Satisfy clippy for server code

This commit is contained in:
monsterkrampe 2023-03-31 15:11:23 +02:00
parent 565683721d
commit ba752514ce
No known key found for this signature in database
GPG Key ID: B8ADC1F5A5CE5057
3 changed files with 8 additions and 13 deletions

View File

@ -44,9 +44,9 @@ pub(crate) struct AcAndGraph {
pub(crate) graph: DoubleLabeledGraph, pub(crate) graph: DoubleLabeledGraph,
} }
impl Into<Bson> for AcAndGraph { impl From<AcAndGraph> for Bson {
fn into(self) -> Bson { fn from(source: AcAndGraph) -> Self {
to_bson(&self).expect("Serialization should work") to_bson(&source).expect("Serialization should work")
} }
} }
@ -297,9 +297,7 @@ async fn add_adf_problem(
Parsing::Naive => Adf::from_parser(&parser), Parsing::Naive => Adf::from_parser(&parser),
Parsing::Hybrid => { Parsing::Hybrid => {
let bd_adf = BdAdf::from_parser(&parser); let bd_adf = BdAdf::from_parser(&parser);
let naive_adf = bd_adf.hybrid_step_opt(false); bd_adf.hybrid_step_opt(false)
naive_adf
} }
}; };
@ -324,8 +322,7 @@ async fn add_adf_problem(
Ok(Err(err)) => HttpResponse::InternalServerError().body(err.to_string()), Ok(Err(err)) => HttpResponse::InternalServerError().body(err.to_string()),
Ok(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)))) => { Ok(Ok(Ok((adf, ac_and_graph)))) => {
let mut acs = AcsPerStrategy::default(); let acs = AcsPerStrategy { parse_only: Some(vec![ac_and_graph]), ..Default::default()};
acs.parse_only = Some(vec![ac_and_graph]);
let adf_problem: AdfProblem = AdfProblem { let adf_problem: AdfProblem = AdfProblem {
name: problem_name, name: problem_name,

View File

@ -40,7 +40,7 @@ async fn main() -> std::io::Result<()> {
// cookie secret ket // cookie secret ket
let secret_key = Key::generate(); let secret_key = Key::generate();
let server = HttpServer::new(move || { HttpServer::new(move || {
let app = App::new(); let app = App::new();
#[cfg(feature = "cors_for_local_development")] #[cfg(feature = "cors_for_local_development")]
@ -89,7 +89,5 @@ async fn main() -> std::io::Result<()> {
}) })
.bind(("0.0.0.0", 8080))? .bind(("0.0.0.0", 8080))?
.run() .run()
.await; .await
server
} }

View File

@ -280,7 +280,7 @@ async fn update_user(
Some(id) => match id.id() { Some(id) => match id.id() {
Err(err) => HttpResponse::InternalServerError().body(err.to_string()), Err(err) => HttpResponse::InternalServerError().body(err.to_string()),
Ok(username) => { 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() return HttpResponse::Conflict()
.body("Username is already taken. Please pick another one!"); .body("Username is already taken. Please pick another one!");