Skip to content

Commit

Permalink
Fix explicit lifetimes for consts (#467)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
juhaku authored Jan 29, 2023
1 parent d19aadf commit 6190978
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion utoipa-gen/src/component/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion utoipa-gen/src/path/response/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Attribute>,
Expand Down

0 comments on commit 6190978

Please sign in to comment.