From 6190978137473c43e2a96516fad9cc2c36030483 Mon Sep 17 00:00:00 2001 From: Juha Kukkonen Date: Sun, 29 Jan 2023 15:32:38 +0200 Subject: [PATCH] Fix explicit lifetimes for consts (#467) Introduce explicit lifetimes for `ToSchema` and `ToResponse` lifetime variables to make library build in Rust 1.60. Automatic lifetime elision for const seems to be available from Rust 1.64 onwards and we want to make sure this lib builds in Rust 1.60 as well. --- utoipa-gen/src/component/schema.rs | 2 +- utoipa-gen/src/path/response/derive.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/utoipa-gen/src/component/schema.rs b/utoipa-gen/src/component/schema.rs index 877bd735..df9dd201 100644 --- a/utoipa-gen/src/component/schema.rs +++ b/utoipa-gen/src/component/schema.rs @@ -51,7 +51,7 @@ pub struct Schema<'a> { } impl<'a> Schema<'a> { - const TO_SCHEMA_LIFETIME: &str = "'__s"; + const TO_SCHEMA_LIFETIME: &'static str = "'__s"; pub fn new( data: &'a Data, attributes: &'a [Attribute], diff --git a/utoipa-gen/src/path/response/derive.rs b/utoipa-gen/src/path/response/derive.rs index 75d17b78..20474fcb 100644 --- a/utoipa-gen/src/path/response/derive.rs +++ b/utoipa-gen/src/path/response/derive.rs @@ -31,7 +31,7 @@ pub struct ToResponse<'r> { } impl<'r> ToResponse<'r> { - const LIFETIME: &str = "'__r"; + const LIFETIME: &'static str = "'__r"; pub fn new( attributes: Vec,