From 748d4516ebb53148c66df9a447a680092c5d5665 Mon Sep 17 00:00:00 2001 From: Valentin Date: Sat, 22 Jun 2019 09:07:39 +0200 Subject: [PATCH] Avoid double Arc inside template_handlebars (#147) --- template_handlebars/src/main.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/template_handlebars/src/main.rs b/template_handlebars/src/main.rs index e49c7ad0..b3003ae6 100644 --- a/template_handlebars/src/main.rs +++ b/template_handlebars/src/main.rs @@ -9,13 +9,11 @@ use actix_web::{App, HttpResponse, HttpServer}; use handlebars::Handlebars; -use std::sync::Arc; - use std::io; // Macro documentation can be found in the actix_web_codegen crate #[get("/")] -fn index(hb: web::Data>) -> HttpResponse { +fn index(hb: web::Data) -> HttpResponse { let data = json!({ "name": "Handlebars" }); @@ -26,7 +24,7 @@ fn index(hb: web::Data>) -> HttpResponse { #[get("/{user}/{data}")] fn user( - hb: web::Data>, + hb: web::Data, info: web::Path<(String, String)>, ) -> HttpResponse { let data = json!({ @@ -46,7 +44,7 @@ fn main() -> io::Result<()> { handlebars .register_templates_directory(".html", "./static/templates") .unwrap(); - let handlebars_ref = web::Data::new(Arc::new(handlebars)); + let handlebars_ref = web::Data::new(handlebars); HttpServer::new(move || { App::new()