fix(idl_gen_rust): Fix lifetime warning added in Rust 1.89 (#8709)

Rust 1.89 added a new lifetime-related warning:
<https://blog.rust-lang.org/2025/08/07/Rust-1.89.0/#mismatched-lifetime-syntaxes-lint>

The Rust code generator currently emits code which trips this warning. This very small PR
fixes the issue for the relevant generated functions and for the Rust flexbuffers code.

Fixes #8705
This commit is contained in:
Rob Jellinghaus
2025-12-02 19:27:40 -08:00
committed by GitHub
parent 4786322b90
commit a5343d6116
9 changed files with 32 additions and 32 deletions

View File

@@ -43,7 +43,7 @@ impl<'a> MapBuilder<'a> {
///
/// This will panic (in debug mode) if `key` contains internal nulls.
#[inline]
pub fn start_vector(&mut self, key: &str) -> VectorBuilder {
pub fn start_vector(&mut self, key: &str) -> VectorBuilder<'_> {
// Push the key that refers to this nested vector.
self.builder.push_key(key);
// Nested vector.
@@ -55,7 +55,7 @@ impl<'a> MapBuilder<'a> {
///
/// This will panic (in debug mode) if `key` contains internal nulls.
#[inline]
pub fn start_map(&mut self, key: &str) -> MapBuilder {
pub fn start_map(&mut self, key: &str) -> MapBuilder<'_> {
// Push the key that refers to this nested vector.
self.builder.push_key(key);
// Nested map.

View File

@@ -36,13 +36,13 @@ impl<'a> VectorBuilder<'a> {
}
/// Starts a nested vector that will be pushed onto this vector when it is dropped.
#[inline]
pub fn start_vector(&mut self) -> VectorBuilder {
pub fn start_vector(&mut self) -> VectorBuilder<'_> {
let start = Some(self.builder.values.len());
VectorBuilder { builder: self.builder, start }
}
/// Starts a nested map that will be pushed onto this vector when it is dropped.
#[inline]
pub fn start_map(&mut self) -> MapBuilder {
pub fn start_map(&mut self) -> MapBuilder<'_> {
let start = Some(self.builder.values.len());
MapBuilder { builder: self.builder, start }
}