Remove unnecessary allocation in hello_2018 example.

This commit is contained in:
Jeb Rosen 2021-03-02 08:36:41 -08:00
parent 9d45e786bb
commit 93e62c86ed
1 changed files with 5 additions and 3 deletions

View File

@ -8,10 +8,12 @@ fn hello() -> &'static str {
#[rocket::launch] #[rocket::launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", rocket::routes![hello]) rocket::ignite()
.mount("/", rocket::routes![hello])
.register(rocket::catchers![not_found])
} }
#[rocket::catch(404)] #[rocket::catch(404)]
fn not_found(_req: &'_ rocket::Request<'_>) -> String { fn not_found(_req: &'_ rocket::Request<'_>) -> &'static str {
"404 Not Found".to_owned() "404 Not Found"
} }