From 5c16023f0094f2f28cf5ba6e7697890b47208957 Mon Sep 17 00:00:00 2001 From: Hendrik Sollich Date: Sat, 30 Nov 2024 10:36:45 +0100 Subject: [PATCH] refactor: fix lifetime warnings introduced in 1.83.0 --- src/parser/components.rs | 4 ++-- src/parser/parameters.rs | 2 +- src/parser/properties.rs | 2 +- src/parser/utils.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/parser/components.rs b/src/parser/components.rs index f985068..ec989ff 100644 --- a/src/parser/components.rs +++ b/src/parser/components.rs @@ -244,7 +244,7 @@ pub fn read_component(input: &str) -> Result, String> { pub fn component<'a, E: ParseError<&'a str> + ContextError<&'a str>>( input: &'a str, -) -> IResult<&'a str, Component, E> { +) -> IResult<&'a str, Component<'a>, E> { let (input, name) = line("BEGIN:", valid_key_sequence_cow)(input)?; let (input, (properties, components)) = many_till( @@ -512,6 +512,6 @@ fn test_faulty_component() { pub fn components<'a, E: ParseError<&'a str> + ContextError<&'a str>>( input: &'a str, -) -> IResult<&'a str, Vec, E> { +) -> IResult<&'a str, Vec>, E> { complete(many0(all_consuming(component)))(input) } diff --git a/src/parser/parameters.rs b/src/parser/parameters.rs index 423e305..9df9c46 100644 --- a/src/parser/parameters.rs +++ b/src/parser/parameters.rs @@ -214,6 +214,6 @@ pub fn parse_parameter_list() { pub fn parameters<'a, E: ParseError<&'a str> + ContextError<&'a str>>( input: &'a str, -) -> IResult<&'a str, Vec, E> { +) -> IResult<&'a str, Vec>, E> { many0(parameter)(input) } diff --git a/src/parser/properties.rs b/src/parser/properties.rs index 4bc0bcd..c39bd16 100644 --- a/src/parser/properties.rs +++ b/src/parser/properties.rs @@ -368,7 +368,7 @@ fn determin_value_type(name: &ParseString, params: &[Parameter]) -> Option + ContextError<&'a str>>( input: &'a str, -) -> IResult<&'a str, Property, E> { +) -> IResult<&'a str, Property<'a>, E> { context( "property", cut(tuple(( diff --git a/src/parser/utils.rs b/src/parser/utils.rs index c019fbf..d04c886 100644 --- a/src/parser/utils.rs +++ b/src/parser/utils.rs @@ -15,7 +15,7 @@ use super::parsed_string::ParseString; // TODO: how do I express <> pub fn property_key<'a, E: ParseError<&'a str> + ContextError<&'a str>>( input: &'a str, -) -> IResult<&'a str, &str, E> { +) -> IResult<&'a str, &'a str, E> { if input.get(0..=2) == Some("END") || input.get(0..=4) == Some("BEGIN") { IResult::Err(Err::Error(nom::error::make_error( input, @@ -28,7 +28,7 @@ pub fn property_key<'a, E: ParseError<&'a str> + ContextError<&'a str>>( pub fn valid_key_sequence<'a, E: ParseError<&'a str> + ContextError<&'a str>>( input: &'a str, -) -> IResult<&'a str, &str, E> { +) -> IResult<&'a str, &'a str, E> { take_while(|c: char| { c == '.' || c == ',' || c == '/' || c == '_' || c == '-' || c.is_alphanumeric() })