Skip to content

Commit

Permalink
dev: fix clippy warnings for: src/routes/about.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
da2ce7 committed May 10, 2023
1 parent f1b3663 commit 21493b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
20 changes: 16 additions & 4 deletions src/routes/about.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use crate::errors::ServiceResult;
pub fn init_routes(cfg: &mut web::ServiceConfig) {
cfg.service(
web::scope("/about")
.service(web::resource("").route(web::get().to(get_about)))
.service(web::resource("/license").route(web::get().to(get_license))),
.service(web::resource("").route(web::get().to(get)))
.service(web::resource("/license").route(web::get().to(license))),
);
}

Expand All @@ -29,7 +29,13 @@ const ABOUT: &str = r#"
</html>
"#;

pub async fn get_about() -> ServiceResult<impl Responder> {
/// Get About Section HTML
///
/// # Errors
///
/// This function will not return an error.
#[allow(clippy::unused_async)]
pub async fn get() -> ServiceResult<impl Responder> {
Ok(HttpResponse::build(StatusCode::OK)
.content_type("text/html; charset=utf-8")
.body(ABOUT))
Expand Down Expand Up @@ -63,7 +69,13 @@ const LICENSE: &str = r#"
</html>
"#;

pub async fn get_license() -> ServiceResult<impl Responder> {
/// Get the License in HTML
///
/// # Errors
///
/// This function will not return an error.
#[allow(clippy::unused_async)]
pub async fn license() -> ServiceResult<impl Responder> {
Ok(HttpResponse::build(StatusCode::OK)
.content_type("text/html; charset=utf-8")
.body(LICENSE))
Expand Down
2 changes: 1 addition & 1 deletion src/routes/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ use actix_web::web;
use crate::routes::about;

pub fn init_routes(cfg: &mut web::ServiceConfig) {
cfg.service(web::scope("/").service(web::resource("").route(web::get().to(about::get_about))));
cfg.service(web::scope("/").service(web::resource("").route(web::get().to(about::get))));
}

0 comments on commit 21493b0

Please sign in to comment.