diff options
author | Martin Fischer <martin@push-f.com> | 2022-07-27 15:22:26 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2022-07-27 15:23:28 +0200 |
commit | 2d9d1f7fa444204a9045f08e19af763f465af383 (patch) | |
tree | f29061a67ffc1ceb1b9b802bdd75f46942d302ab /src/main.rs | |
parent | 98b0f80bdd1a0d5cebabf093651f66623a39cbd9 (diff) |
refactor: remove needless borrows / returns
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index 1f3f890..be38348 100644 --- a/src/main.rs +++ b/src/main.rs @@ -185,7 +185,7 @@ async fn serve<C: Controller + Send + Sync + 'static>(controller: C, args: Args) async move { Ok::<_, hyper::Error>(service_fn(move |req| { - service(&origin, controller.clone(), req) + service(origin, controller.clone(), req) })) } }); @@ -202,7 +202,7 @@ async fn service<C: Controller>( let (mut parts, body) = request.into_parts(); let mut script_csp = "'none'".into(); - let mut frame_csp = "'none'".into(); + let mut frame_csp = "'none'"; let mut resp = build_response(origin, &*controller, &mut parts, body) .await @@ -323,8 +323,7 @@ async fn build_response<C: Controller>( let repo = Repository::open_bare(env::current_dir().unwrap()).unwrap(); - let (rev, unsanitized_path) = match controller.parse_url_path(&unsanitized_path, &parts, &repo) - { + let (rev, unsanitized_path) = match controller.parse_url_path(&unsanitized_path, parts, &repo) { Ok(parsed) => parsed, Err(res) => return res, }; @@ -368,7 +367,7 @@ async fn build_response<C: Controller>( .map(|r| r.into_commit().unwrap().tree().unwrap()); if ctx.path.components().next().is_some() { - let entr = match tree.and_then(|t| t.get_path(&ctx.path.as_ref())) { + let entr = match tree.and_then(|t| t.get_path(ctx.path.as_ref())) { Ok(entr) => entr, Err(_) => { if unsanitized_path.ends_with('/') { @@ -411,7 +410,7 @@ async fn build_response<C: Controller>( .unwrap() .into()); } - return get_routes::get_blob(entr, params, controller, ctx, &parts); + return get_routes::get_blob(entr, params, controller, ctx, parts); } tree = ctx.repo.find_tree(entr.id()); @@ -420,7 +419,7 @@ async fn build_response<C: Controller>( } } - get_routes::view_tree(tree, controller, &ctx, &parts) + get_routes::view_tree(tree, controller, &ctx, parts) } fn render_link(name: &str, label: &str, active_action: &str) -> String { |