Skip to content

Commit 93e62c8

Browse files
committed
Remove unnecessary allocation in hello_2018 example.
1 parent 9d45e78 commit 93e62c8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

examples/hello_2018/src/main.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ fn hello() -> &'static str {
88

99
#[rocket::launch]
1010
fn rocket() -> rocket::Rocket {
11-
rocket::ignite().mount("/", rocket::routes![hello])
11+
rocket::ignite()
12+
.mount("/", rocket::routes![hello])
13+
.register(rocket::catchers![not_found])
1214
}
1315

1416
#[rocket::catch(404)]
15-
fn not_found(_req: &'_ rocket::Request<'_>) -> String {
16-
"404 Not Found".to_owned()
17+
fn not_found(_req: &'_ rocket::Request<'_>) -> &'static str {
18+
"404 Not Found"
1719
}

0 commit comments

Comments
 (0)