From 8d8f3fea3700201d9c5c2b93b23cb184e9e635f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Tue, 25 Jun 2024 15:50:46 +0200 Subject: [PATCH] parsers: fix accidental MSRV bump The previous code didn't build with 1.78: ``` error[E0716]: temporary value dropped while borrowed --> parsers/src/data_forms/validate.rs:394:46 | 380 | let value = match self { | ----- borrow later stored here ... 394 | Datatype::UserDefined(value) => &format!("x:{value}"), | ^^^^^^^^^^^^^^^^^^^- | | | | | temporary value is freed at the end of this statement | creates a temporary value which is freed while still in use | = note: consider using a `let` binding to create a longer lived value = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0716]: temporary value dropped while borrowed --> parsers/src/data_forms/validate.rs:395:51 | 380 | let value = match self { | ----- borrow later stored here ... 395 | Datatype::Other { prefix, value } => &format!("{prefix}:{value}"), | ^^^^^^^^^^^^^^^^^^^^^^^^^^- | | | | | temporary value is freed at the end of this statement | creates a temporary value which is freed while still in use | = note: consider using a `let` binding to create a longer lived value = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) For more information about this error, try `rustc --explain E0716`. ``` This seems like a silly reason to pull up the compiler version requirements, so I fixed it with a trivial modification. --- parsers/src/data_forms/validate.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parsers/src/data_forms/validate.rs b/parsers/src/data_forms/validate.rs index cfd716e8..58e16318 100644 --- a/parsers/src/data_forms/validate.rs +++ b/parsers/src/data_forms/validate.rs @@ -391,10 +391,10 @@ impl Display for Datatype { Datatype::Short => "xs:short", Datatype::String => "xs:string", Datatype::Time => "xs:time", - Datatype::UserDefined(value) => &format!("x:{value}"), - Datatype::Other { prefix, value } => &format!("{prefix}:{value}"), + Datatype::UserDefined(value) => return write!(f, "x:{value}"), + Datatype::Other { prefix, value } => return write!(f, "{prefix}:{value}"), }; - write!(f, "{value}") + f.write_str(value) } }