Is it possible to remove lifetime parameter <'a> from signature of function where lifetime is used for Iterator<Item = 'a u8> in function which return owned value? Example of such function is
fn build_string<'a, I>(iter: &mut I) -> String
where
I: Iterator<Item = &'a u8>,
{
match iter.next() {
Some(x) => format!("Value is {x}"),
None => "No value".to_owned(),
}
}
According my current (pure) knowledge is rust is lifetime parameter 'a in <'a, I> unnecessary, because this function build owned value with lifetime independent on iterator.