mirror of
https://github.com/rwf2/Rocket.git
synced 2025-03-03 13:02:03 +00:00
Add missing lifetime parameter in codegen for routes and catchers.
This is linted against by `elided_lifetimes_in_paths`, which is not enabled by default but is part of the `rust_2018_idioms` lint group.
This commit is contained in:
parent
59346ccfdc
commit
e332ee83da
@ -127,7 +127,7 @@ pub fn _catch(
|
|||||||
fn from(_: #user_catcher_fn_name) -> #StaticCatcherInfo {
|
fn from(_: #user_catcher_fn_name) -> #StaticCatcherInfo {
|
||||||
fn monomorphized_function<'_b>(
|
fn monomorphized_function<'_b>(
|
||||||
#status: #Status,
|
#status: #Status,
|
||||||
#req: &'_b #Request
|
#req: &'_b #Request<'_>
|
||||||
) -> #ErrorHandlerFuture<'_b> {
|
) -> #ErrorHandlerFuture<'_b> {
|
||||||
#_Box::pin(async move {
|
#_Box::pin(async move {
|
||||||
let __response = #catcher_response;
|
let __response = #catcher_response;
|
||||||
|
@ -432,7 +432,7 @@ fn codegen_route(route: Route) -> Result<TokenStream> {
|
|||||||
impl From<#user_handler_fn_name> for #StaticRouteInfo {
|
impl From<#user_handler_fn_name> for #StaticRouteInfo {
|
||||||
fn from(_: #user_handler_fn_name) -> #StaticRouteInfo {
|
fn from(_: #user_handler_fn_name) -> #StaticRouteInfo {
|
||||||
fn monomorphized_function<'_b>(
|
fn monomorphized_function<'_b>(
|
||||||
#req: &'_b #Request,
|
#req: &'_b #Request<'_>,
|
||||||
#data: #Data
|
#data: #Data
|
||||||
) -> #HandlerFuture<'_b> {
|
) -> #HandlerFuture<'_b> {
|
||||||
#_Box::pin(async move {
|
#_Box::pin(async move {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#![warn(rust_2018_idioms)]
|
||||||
#[cfg(test)] mod tests;
|
#[cfg(test)] mod tests;
|
||||||
|
|
||||||
#[rocket::get("/")]
|
#[rocket::get("/")]
|
||||||
@ -9,3 +10,8 @@ fn hello() -> &'static str {
|
|||||||
fn rocket() -> rocket::Rocket {
|
fn rocket() -> rocket::Rocket {
|
||||||
rocket::ignite().mount("/", rocket::routes![hello])
|
rocket::ignite().mount("/", rocket::routes![hello])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rocket::catch(404)]
|
||||||
|
fn not_found(_req: &'_ rocket::Request<'_>) -> String {
|
||||||
|
"404 Not Found".to_owned()
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user